@tscircuit/eval 0.0.828 → 0.0.830
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blob-url.js +1 -1
- package/dist/eval/index.js +18 -1
- package/dist/lib/index.js +18 -1
- package/dist/platform-config/getPlatformConfig.js +14 -1
- package/dist/webworker/entrypoint.js +12 -11
- package/package.json +4 -3
|
@@ -212,21 +212,21 @@ No matching component was found for:
|
|
|
212
212
|
Use "options.replacer" or "options.ignoreUnknown"
|
|
213
213
|
`)},_domwindow:function(){return u6("domwindow")},_bigint:function(e6){return u6("bigint:"+e6.toString())},_process:function(){return u6("process")},_timer:function(){return u6("timer")},_pipe:function(){return u6("pipe")},_tcp:function(){return u6("tcp")},_udp:function(){return u6("udp")},_tty:function(){return u6("tty")},_statwatcher:function(){return u6("statwatcher")},_securecontext:function(){return u6("securecontext")},_connection:function(){return u6("connection")},_zlib:function(){return u6("zlib")},_context:function(){return u6("context")},_nodescript:function(){return u6("nodescript")},_httpparser:function(){return u6("httpparser")},_dataview:function(){return u6("dataview")},_signal:function(){return u6("signal")},_fsevent:function(){return u6("fsevent")},_tlswrap:function(){return u6("tlswrap")}}}function l4(){return{buf:"",write:function(e6){this.buf+=e6},end:function(e6){this.buf+=e6},read:function(){return this.buf}}}m4.writeToStream=function(e6,t53,n5){return n5===void 0&&(n5=t53,t53={}),f3(t53=u5(e6,t53),n5).dispatch(e6)}}).call(this,w4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},w4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e5,t52,f3){(function(e6,t53,n4,r5,o4,i3,u5,s3,a3){(function(e7){"use strict";var a4=typeof Uint8Array<"u"?Uint8Array:Array,t54=43,n5=47,r6=48,o6=97,i4=65,u6=45,s4=95;function f4(e8){return e8=e8.charCodeAt(0),e8===t54||e8===u6?62:e8===n5||e8===s4?63:e8<r6?-1:e8<r6+10?e8-r6+26+26:e8<i4+26?e8-i4:e8<o6+26?e8-o6+26:void 0}e7.toByteArray=function(e8){var t55,n6;if(0<e8.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var r7=e8.length,r7=e8.charAt(r7-2)==="="?2:e8.charAt(r7-1)==="="?1:0,o7=new a4(3*e8.length/4-r7),i5=0<r7?e8.length-4:e8.length,u7=0;function s5(e10){o7[u7++]=e10}for(t55=0;t55<i5;t55+=4,0)s5((16711680&(n6=f4(e8.charAt(t55))<<18|f4(e8.charAt(t55+1))<<12|f4(e8.charAt(t55+2))<<6|f4(e8.charAt(t55+3))))>>16),s5((65280&n6)>>8),s5(255&n6);return r7==2?s5(255&(n6=f4(e8.charAt(t55))<<2|f4(e8.charAt(t55+1))>>4)):r7==1&&(s5((n6=f4(e8.charAt(t55))<<10|f4(e8.charAt(t55+1))<<4|f4(e8.charAt(t55+2))>>2)>>8&255),s5(255&n6)),o7},e7.fromByteArray=function(e8){var t55,n6,r7,o7,i5=e8.length%3,u7="";function s5(e10){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e10)}for(t55=0,r7=e8.length-i5;t55<r7;t55+=3)n6=(e8[t55]<<16)+(e8[t55+1]<<8)+e8[t55+2],u7+=s5((o7=n6)>>18&63)+s5(o7>>12&63)+s5(o7>>6&63)+s5(63&o7);switch(i5){case 1:u7=(u7+=s5((n6=e8[e8.length-1])>>2))+s5(n6<<4&63)+"==";break;case 2:u7=(u7=(u7+=s5((n6=(e8[e8.length-2]<<8)+e8[e8.length-1])>>10))+s5(n6>>4&63))+s5(n6<<2&63)+"="}return u7}})(f3===void 0?this.base64js={}:f3)}).call(this,e5("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e5("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(O3,e5,H4){(function(e6,n4,f3,r5,h6,p4,g6,y4,w4){var a3=O3("base64-js"),i3=O3("ieee754");function f3(e7,t53,n5){if(!(this instanceof f3))return new f3(e7,t53,n5);var r6,o6,i4,u6,s4=typeof e7;if(t53==="base64"&&s4=="string")for(e7=(u6=e7).trim?u6.trim():u6.replace(/^\s+|\s+$/g,"");e7.length%4!=0;)e7+="=";if(s4=="number")r6=j4(e7);else if(s4=="string")r6=f3.byteLength(e7,t53);else{if(s4!="object")throw new Error("First argument needs to be a number, array or string.");r6=j4(e7.length)}if(f3._useTypedArrays?o6=f3._augment(new Uint8Array(r6)):((o6=this).length=r6,o6._isBuffer=!0),f3._useTypedArrays&&typeof e7.byteLength=="number")o6._set(e7);else if(C4(u6=e7)||f3.isBuffer(u6)||u6&&typeof u6=="object"&&typeof u6.length=="number")for(i4=0;i4<r6;i4++)f3.isBuffer(e7)?o6[i4]=e7.readUInt8(i4):o6[i4]=e7[i4];else if(s4=="string")o6.write(e7,0,t53);else if(s4=="number"&&!f3._useTypedArrays&&!n5)for(i4=0;i4<r6;i4++)o6[i4]=0;return o6}function b3(e7,t53,n5,r6){return f3._charsWritten=c4((function(e8){for(var t54=[],n6=0;n6<e8.length;n6++)t54.push(255&e8.charCodeAt(n6));return t54})(t53),e7,n5,r6)}function m4(e7,t53,n5,r6){return f3._charsWritten=c4((function(e8){for(var t54,n6,r7=[],o6=0;o6<e8.length;o6++)n6=e8.charCodeAt(o6),t54=n6>>8,n6=n6%256,r7.push(n6),r7.push(t54);return r7})(t53),e7,n5,r6)}function v4(e7,t53,n5){var r6="";n5=Math.min(e7.length,n5);for(var o6=t53;o6<n5;o6++)r6+=String.fromCharCode(e7[o6]);return r6}function o4(e7,t53,n5,r6){r6||(d4(typeof n5=="boolean","missing or invalid endian"),d4(t53!=null,"missing offset"),d4(t53+1<e7.length,"Trying to read beyond buffer length"));var o6,r6=e7.length;if(!(r6<=t53))return n5?(o6=e7[t53],t53+1<r6&&(o6|=e7[t53+1]<<8)):(o6=e7[t53]<<8,t53+1<r6&&(o6|=e7[t53+1])),o6}function u5(e7,t53,n5,r6){r6||(d4(typeof n5=="boolean","missing or invalid endian"),d4(t53!=null,"missing offset"),d4(t53+3<e7.length,"Trying to read beyond buffer length"));var o6,r6=e7.length;if(!(r6<=t53))return n5?(t53+2<r6&&(o6=e7[t53+2]<<16),t53+1<r6&&(o6|=e7[t53+1]<<8),o6|=e7[t53],t53+3<r6&&(o6+=e7[t53+3]<<24>>>0)):(t53+1<r6&&(o6=e7[t53+1]<<16),t53+2<r6&&(o6|=e7[t53+2]<<8),t53+3<r6&&(o6|=e7[t53+3]),o6+=e7[t53]<<24>>>0),o6}function _4(e7,t53,n5,r6){if(r6||(d4(typeof n5=="boolean","missing or invalid endian"),d4(t53!=null,"missing offset"),d4(t53+1<e7.length,"Trying to read beyond buffer length")),!(e7.length<=t53))return r6=o4(e7,t53,n5,!0),32768&r6?-1*(65535-r6+1):r6}function E3(e7,t53,n5,r6){if(r6||(d4(typeof n5=="boolean","missing or invalid endian"),d4(t53!=null,"missing offset"),d4(t53+3<e7.length,"Trying to read beyond buffer length")),!(e7.length<=t53))return r6=u5(e7,t53,n5,!0),2147483648&r6?-1*(4294967295-r6+1):r6}function I4(e7,t53,n5,r6){return r6||(d4(typeof n5=="boolean","missing or invalid endian"),d4(t53+3<e7.length,"Trying to read beyond buffer length")),i3.read(e7,t53,n5,23,4)}function A4(e7,t53,n5,r6){return r6||(d4(typeof n5=="boolean","missing or invalid endian"),d4(t53+7<e7.length,"Trying to read beyond buffer length")),i3.read(e7,t53,n5,52,8)}function s3(e7,t53,n5,r6,o6){if(o6||(d4(t53!=null,"missing value"),d4(typeof r6=="boolean","missing or invalid endian"),d4(n5!=null,"missing offset"),d4(n5+1<e7.length,"trying to write beyond buffer length"),Y4(t53,65535)),o6=e7.length,!(o6<=n5))for(var i4=0,u6=Math.min(o6-n5,2);i4<u6;i4++)e7[n5+i4]=(t53&255<<8*(r6?i4:1-i4))>>>8*(r6?i4:1-i4)}function l4(e7,t53,n5,r6,o6){if(o6||(d4(t53!=null,"missing value"),d4(typeof r6=="boolean","missing or invalid endian"),d4(n5!=null,"missing offset"),d4(n5+3<e7.length,"trying to write beyond buffer length"),Y4(t53,4294967295)),o6=e7.length,!(o6<=n5))for(var i4=0,u6=Math.min(o6-n5,4);i4<u6;i4++)e7[n5+i4]=t53>>>8*(r6?i4:3-i4)&255}function B4(e7,t53,n5,r6,o6){o6||(d4(t53!=null,"missing value"),d4(typeof r6=="boolean","missing or invalid endian"),d4(n5!=null,"missing offset"),d4(n5+1<e7.length,"Trying to write beyond buffer length"),F4(t53,32767,-32768)),e7.length<=n5||s3(e7,0<=t53?t53:65535+t53+1,n5,r6,o6)}function L3(e7,t53,n5,r6,o6){o6||(d4(t53!=null,"missing value"),d4(typeof r6=="boolean","missing or invalid endian"),d4(n5!=null,"missing offset"),d4(n5+3<e7.length,"Trying to write beyond buffer length"),F4(t53,2147483647,-2147483648)),e7.length<=n5||l4(e7,0<=t53?t53:4294967295+t53+1,n5,r6,o6)}function U3(e7,t53,n5,r6,o6){o6||(d4(t53!=null,"missing value"),d4(typeof r6=="boolean","missing or invalid endian"),d4(n5!=null,"missing offset"),d4(n5+3<e7.length,"Trying to write beyond buffer length"),D4(t53,34028234663852886e22,-34028234663852886e22)),e7.length<=n5||i3.write(e7,t53,n5,r6,23,4)}function x4(e7,t53,n5,r6,o6){o6||(d4(t53!=null,"missing value"),d4(typeof r6=="boolean","missing or invalid endian"),d4(n5!=null,"missing offset"),d4(n5+7<e7.length,"Trying to write beyond buffer length"),D4(t53,17976931348623157e292,-17976931348623157e292)),e7.length<=n5||i3.write(e7,t53,n5,r6,52,8)}H4.Buffer=f3,H4.SlowBuffer=f3,H4.INSPECT_MAX_BYTES=50,f3.poolSize=8192,f3._useTypedArrays=(function(){try{var e7=new ArrayBuffer(0),t53=new Uint8Array(e7);return t53.foo=function(){return 42},t53.foo()===42&&typeof t53.subarray=="function"}catch{return!1}})(),f3.isEncoding=function(e7){switch(String(e7).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f3.isBuffer=function(e7){return!(e7==null||!e7._isBuffer)},f3.byteLength=function(e7,t53){var n5;switch(e7+="",t53||"utf8"){case"hex":n5=e7.length/2;break;case"utf8":case"utf-8":n5=T4(e7).length;break;case"ascii":case"binary":case"raw":n5=e7.length;break;case"base64":n5=M4(e7).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n5=2*e7.length;break;default:throw new Error("Unknown encoding")}return n5},f3.concat=function(e7,t53){if(d4(C4(e7),`Usage: Buffer.concat(list, [totalLength])
|
|
214
214
|
list should be an Array.`),e7.length===0)return new f3(0);if(e7.length===1)return e7[0];if(typeof t53!="number")for(o6=t53=0;o6<e7.length;o6++)t53+=e7[o6].length;for(var n5=new f3(t53),r6=0,o6=0;o6<e7.length;o6++){var i4=e7[o6];i4.copy(n5,r6),r6+=i4.length}return n5},f3.prototype.write=function(e7,t53,n5,r6){isFinite(t53)?isFinite(n5)||(r6=n5,n5=void 0):(a4=r6,r6=t53,t53=n5,n5=a4),t53=Number(t53)||0;var o6,i4,u6,s4,a4=this.length-t53;switch((!n5||a4<(n5=Number(n5)))&&(n5=a4),r6=String(r6||"utf8").toLowerCase()){case"hex":o6=(function(e8,t54,n6,r7){n6=Number(n6)||0;var o7=e8.length-n6;(!r7||o7<(r7=Number(r7)))&&(r7=o7),d4((o7=t54.length)%2==0,"Invalid hex string"),o7/2<r7&&(r7=o7/2);for(var i5=0;i5<r7;i5++){var u7=parseInt(t54.substr(2*i5,2),16);d4(!isNaN(u7),"Invalid hex string"),e8[n6+i5]=u7}return f3._charsWritten=2*i5,i5})(this,e7,t53,n5);break;case"utf8":case"utf-8":i4=this,u6=t53,s4=n5,o6=f3._charsWritten=c4(T4(e7),i4,u6,s4);break;case"ascii":case"binary":o6=b3(this,e7,t53,n5);break;case"base64":i4=this,u6=t53,s4=n5,o6=f3._charsWritten=c4(M4(e7),i4,u6,s4);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":o6=m4(this,e7,t53,n5);break;default:throw new Error("Unknown encoding")}return o6},f3.prototype.toString=function(e7,t53,n5){var r6,o6,i4,u6,s4=this;if(e7=String(e7||"utf8").toLowerCase(),t53=Number(t53)||0,(n5=n5!==void 0?Number(n5):s4.length)===t53)return"";switch(e7){case"hex":r6=(function(e8,t54,n6){var r7=e8.length;(!t54||t54<0)&&(t54=0),(!n6||n6<0||r7<n6)&&(n6=r7);for(var o7="",i5=t54;i5<n6;i5++)o7+=k4(e8[i5]);return o7})(s4,t53,n5);break;case"utf8":case"utf-8":r6=(function(e8,t54,n6){var r7="",o7="";n6=Math.min(e8.length,n6);for(var i5=t54;i5<n6;i5++)e8[i5]<=127?(r7+=N4(o7)+String.fromCharCode(e8[i5]),o7=""):o7+="%"+e8[i5].toString(16);return r7+N4(o7)})(s4,t53,n5);break;case"ascii":case"binary":r6=v4(s4,t53,n5);break;case"base64":o6=s4,u6=n5,r6=(i4=t53)===0&&u6===o6.length?a3.fromByteArray(o6):a3.fromByteArray(o6.slice(i4,u6));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r6=(function(e8,t54,n6){for(var r7=e8.slice(t54,n6),o7="",i5=0;i5<r7.length;i5+=2)o7+=String.fromCharCode(r7[i5]+256*r7[i5+1]);return o7})(s4,t53,n5);break;default:throw new Error("Unknown encoding")}return r6},f3.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},f3.prototype.copy=function(e7,t53,n5,r6){if(t53=t53||0,(r6=r6||r6===0?r6:this.length)!==(n5=n5||0)&&e7.length!==0&&this.length!==0){d4(n5<=r6,"sourceEnd < sourceStart"),d4(0<=t53&&t53<e7.length,"targetStart out of bounds"),d4(0<=n5&&n5<this.length,"sourceStart out of bounds"),d4(0<=r6&&r6<=this.length,"sourceEnd out of bounds"),r6>this.length&&(r6=this.length);var o6=(r6=e7.length-t53<r6-n5?e7.length-t53+n5:r6)-n5;if(o6<100||!f3._useTypedArrays)for(var i4=0;i4<o6;i4++)e7[i4+t53]=this[i4+n5];else e7._set(this.subarray(n5,n5+o6),t53)}},f3.prototype.slice=function(e7,t53){var n5=this.length;if(e7=S3(e7,n5,0),t53=S3(t53,n5,n5),f3._useTypedArrays)return f3._augment(this.subarray(e7,t53));for(var r6=t53-e7,o6=new f3(r6,void 0,!0),i4=0;i4<r6;i4++)o6[i4]=this[i4+e7];return o6},f3.prototype.get=function(e7){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e7)},f3.prototype.set=function(e7,t53){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e7,t53)},f3.prototype.readUInt8=function(e7,t53){if(t53||(d4(e7!=null,"missing offset"),d4(e7<this.length,"Trying to read beyond buffer length")),!(e7>=this.length))return this[e7]},f3.prototype.readUInt16LE=function(e7,t53){return o4(this,e7,!0,t53)},f3.prototype.readUInt16BE=function(e7,t53){return o4(this,e7,!1,t53)},f3.prototype.readUInt32LE=function(e7,t53){return u5(this,e7,!0,t53)},f3.prototype.readUInt32BE=function(e7,t53){return u5(this,e7,!1,t53)},f3.prototype.readInt8=function(e7,t53){if(t53||(d4(e7!=null,"missing offset"),d4(e7<this.length,"Trying to read beyond buffer length")),!(e7>=this.length))return 128&this[e7]?-1*(255-this[e7]+1):this[e7]},f3.prototype.readInt16LE=function(e7,t53){return _4(this,e7,!0,t53)},f3.prototype.readInt16BE=function(e7,t53){return _4(this,e7,!1,t53)},f3.prototype.readInt32LE=function(e7,t53){return E3(this,e7,!0,t53)},f3.prototype.readInt32BE=function(e7,t53){return E3(this,e7,!1,t53)},f3.prototype.readFloatLE=function(e7,t53){return I4(this,e7,!0,t53)},f3.prototype.readFloatBE=function(e7,t53){return I4(this,e7,!1,t53)},f3.prototype.readDoubleLE=function(e7,t53){return A4(this,e7,!0,t53)},f3.prototype.readDoubleBE=function(e7,t53){return A4(this,e7,!1,t53)},f3.prototype.writeUInt8=function(e7,t53,n5){n5||(d4(e7!=null,"missing value"),d4(t53!=null,"missing offset"),d4(t53<this.length,"trying to write beyond buffer length"),Y4(e7,255)),t53>=this.length||(this[t53]=e7)},f3.prototype.writeUInt16LE=function(e7,t53,n5){s3(this,e7,t53,!0,n5)},f3.prototype.writeUInt16BE=function(e7,t53,n5){s3(this,e7,t53,!1,n5)},f3.prototype.writeUInt32LE=function(e7,t53,n5){l4(this,e7,t53,!0,n5)},f3.prototype.writeUInt32BE=function(e7,t53,n5){l4(this,e7,t53,!1,n5)},f3.prototype.writeInt8=function(e7,t53,n5){n5||(d4(e7!=null,"missing value"),d4(t53!=null,"missing offset"),d4(t53<this.length,"Trying to write beyond buffer length"),F4(e7,127,-128)),t53>=this.length||(0<=e7?this.writeUInt8(e7,t53,n5):this.writeUInt8(255+e7+1,t53,n5))},f3.prototype.writeInt16LE=function(e7,t53,n5){B4(this,e7,t53,!0,n5)},f3.prototype.writeInt16BE=function(e7,t53,n5){B4(this,e7,t53,!1,n5)},f3.prototype.writeInt32LE=function(e7,t53,n5){L3(this,e7,t53,!0,n5)},f3.prototype.writeInt32BE=function(e7,t53,n5){L3(this,e7,t53,!1,n5)},f3.prototype.writeFloatLE=function(e7,t53,n5){U3(this,e7,t53,!0,n5)},f3.prototype.writeFloatBE=function(e7,t53,n5){U3(this,e7,t53,!1,n5)},f3.prototype.writeDoubleLE=function(e7,t53,n5){x4(this,e7,t53,!0,n5)},f3.prototype.writeDoubleBE=function(e7,t53,n5){x4(this,e7,t53,!1,n5)},f3.prototype.fill=function(e7,t53,n5){if(t53=t53||0,n5=n5||this.length,d4(typeof(e7=typeof(e7=e7||0)=="string"?e7.charCodeAt(0):e7)=="number"&&!isNaN(e7),"value is not a number"),d4(t53<=n5,"end < start"),n5!==t53&&this.length!==0){d4(0<=t53&&t53<this.length,"start out of bounds"),d4(0<=n5&&n5<=this.length,"end out of bounds");for(var r6=t53;r6<n5;r6++)this[r6]=e7}},f3.prototype.inspect=function(){for(var e7=[],t53=this.length,n5=0;n5<t53;n5++)if(e7[n5]=k4(this[n5]),n5===H4.INSPECT_MAX_BYTES){e7[n5+1]="...";break}return"<Buffer "+e7.join(" ")+">"},f3.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(f3._useTypedArrays)return new f3(this).buffer;for(var e7=new Uint8Array(this.length),t53=0,n5=e7.length;t53<n5;t53+=1)e7[t53]=this[t53];return e7.buffer};var t52=f3.prototype;function S3(e7,t53,n5){return typeof e7!="number"?n5:t53<=(e7=~~e7)?t53:0<=e7||0<=(e7+=t53)?e7:0}function j4(e7){return(e7=~~Math.ceil(+e7))<0?0:e7}function C4(e7){return(Array.isArray||function(e8){return Object.prototype.toString.call(e8)==="[object Array]"})(e7)}function k4(e7){return e7<16?"0"+e7.toString(16):e7.toString(16)}function T4(e7){for(var t53=[],n5=0;n5<e7.length;n5++){var r6=e7.charCodeAt(n5);if(r6<=127)t53.push(e7.charCodeAt(n5));else for(var o6=n5,i4=(55296<=r6&&r6<=57343&&n5++,encodeURIComponent(e7.slice(o6,n5+1)).substr(1).split("%")),u6=0;u6<i4.length;u6++)t53.push(parseInt(i4[u6],16))}return t53}function M4(e7){return a3.toByteArray(e7)}function c4(e7,t53,n5,r6){for(var o6=0;o6<r6&&!(o6+n5>=t53.length||o6>=e7.length);o6++)t53[o6+n5]=e7[o6];return o6}function N4(e7){try{return decodeURIComponent(e7)}catch{return"\uFFFD"}}function Y4(e7,t53){d4(typeof e7=="number","cannot write a non-number as a number"),d4(0<=e7,"specified a negative value for writing an unsigned value"),d4(e7<=t53,"value is larger than maximum value for type"),d4(Math.floor(e7)===e7,"value has a fractional component")}function F4(e7,t53,n5){d4(typeof e7=="number","cannot write a non-number as a number"),d4(e7<=t53,"value larger than maximum allowed value"),d4(n5<=e7,"value smaller than minimum allowed value"),d4(Math.floor(e7)===e7,"value has a fractional component")}function D4(e7,t53,n5){d4(typeof e7=="number","cannot write a non-number as a number"),d4(e7<=t53,"value larger than maximum allowed value"),d4(n5<=e7,"value smaller than minimum allowed value")}function d4(e7,t53){if(!e7)throw new Error(t53||"Failed assertion")}f3._augment=function(e7){return e7._isBuffer=!0,e7._get=e7.get,e7._set=e7.set,e7.get=t52.get,e7.set=t52.set,e7.write=t52.write,e7.toString=t52.toString,e7.toLocaleString=t52.toString,e7.toJSON=t52.toJSON,e7.copy=t52.copy,e7.slice=t52.slice,e7.readUInt8=t52.readUInt8,e7.readUInt16LE=t52.readUInt16LE,e7.readUInt16BE=t52.readUInt16BE,e7.readUInt32LE=t52.readUInt32LE,e7.readUInt32BE=t52.readUInt32BE,e7.readInt8=t52.readInt8,e7.readInt16LE=t52.readInt16LE,e7.readInt16BE=t52.readInt16BE,e7.readInt32LE=t52.readInt32LE,e7.readInt32BE=t52.readInt32BE,e7.readFloatLE=t52.readFloatLE,e7.readFloatBE=t52.readFloatBE,e7.readDoubleLE=t52.readDoubleLE,e7.readDoubleBE=t52.readDoubleBE,e7.writeUInt8=t52.writeUInt8,e7.writeUInt16LE=t52.writeUInt16LE,e7.writeUInt16BE=t52.writeUInt16BE,e7.writeUInt32LE=t52.writeUInt32LE,e7.writeUInt32BE=t52.writeUInt32BE,e7.writeInt8=t52.writeInt8,e7.writeInt16LE=t52.writeInt16LE,e7.writeInt16BE=t52.writeInt16BE,e7.writeInt32LE=t52.writeInt32LE,e7.writeInt32BE=t52.writeInt32BE,e7.writeFloatLE=t52.writeFloatLE,e7.writeFloatBE=t52.writeFloatBE,e7.writeDoubleLE=t52.writeDoubleLE,e7.writeDoubleBE=t52.writeDoubleBE,e7.fill=t52.fill,e7.inspect=t52.inspect,e7.toArrayBuffer=t52.toArrayBuffer,e7}}).call(this,O3("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},O3("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(c4,d4,e5){(function(e6,t52,a3,n4,r5,o4,i3,u5,s3){var a3=c4("buffer").Buffer,f3=4,l4=new a3(f3);l4.fill(0),d4.exports={hash:function(e7,t53,n5,r6){for(var o6=t53((function(e8,t54){e8.length%f3!=0&&(n6=e8.length+(f3-e8.length%f3),e8=a3.concat([e8,l4],n6));for(var n6,r7=[],o7=t54?e8.readInt32BE:e8.readInt32LE,i5=0;i5<e8.length;i5+=f3)r7.push(o7.call(e8,i5));return r7})(e7=a3.isBuffer(e7)?e7:new a3(e7),r6),8*e7.length),t53=r6,i4=new a3(n5),u6=t53?i4.writeInt32BE:i4.writeInt32LE,s4=0;s4<o6.length;s4++)u6.call(i4,o6[s4],4*s4,!0);return i4}}}).call(this,c4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},c4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(v4,e5,_4){(function(l4,c4,u5,d4,h6,p4,g6,y4,w4){var u5=v4("buffer").Buffer,e6=v4("./sha"),t52=v4("./sha256"),n4=v4("./rng"),b3={sha1:e6,sha256:t52,md5:v4("./md5")},s3=64,a3=new u5(s3);function r5(e7,n5){var r6=b3[e7=e7||"sha1"],o6=[];return r6||i3("algorithm:",e7,"is not yet supported"),{update:function(e8){return u5.isBuffer(e8)||(e8=new u5(e8)),o6.push(e8),e8.length,this},digest:function(e8){var t53=u5.concat(o6),t53=n5?(function(e10,t54,n6){u5.isBuffer(t54)||(t54=new u5(t54)),u5.isBuffer(n6)||(n6=new u5(n6)),t54.length>s3?t54=e10(t54):t54.length<s3&&(t54=u5.concat([t54,a3],s3));for(var r7=new u5(s3),o7=new u5(s3),i4=0;i4<s3;i4++)r7[i4]=54^t54[i4],o7[i4]=92^t54[i4];return n6=e10(u5.concat([r7,n6])),e10(u5.concat([o7,n6]))})(r6,n5,t53):r6(t53);return o6=null,e8?t53.toString(e8):t53}}}function i3(){var e7=[].slice.call(arguments).join(" ");throw new Error([e7,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
215
|
-
`))}a3.fill(0),_4.createHash=function(e7){return r5(e7)},_4.createHmac=r5,_4.randomBytes=function(e7,t53){if(!t53||!t53.call)return new u5(n4(e7));try{t53.call(this,void 0,new u5(n4(e7)))}catch(e8){t53(e8)}};var o4,f3=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],m4=function(e7){_4[e7]=function(){i3("sorry,",e7,"is not implemented yet")}};for(o4 in f3)m4(f3[o4],o4)}).call(this,v4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},v4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(w4,b3,e5){(function(e6,r5,o4,i3,u5,a3,f3,l4,y4){var t52=w4("./helpers");function n4(e7,t53){e7[t53>>5]|=128<<t53%32,e7[14+(t53+64>>>9<<4)]=t53;for(var n5=1732584193,r6=-271733879,o6=-1732584194,i4=271733878,u6=0;u6<e7.length;u6+=16){var s4=n5,a4=r6,f4=o6,l5=i4,n5=c4(n5,r6,o6,i4,e7[u6+0],7,-680876936),i4=c4(i4,n5,r6,o6,e7[u6+1],12,-389564586),o6=c4(o6,i4,n5,r6,e7[u6+2],17,606105819),r6=c4(r6,o6,i4,n5,e7[u6+3],22,-1044525330);n5=c4(n5,r6,o6,i4,e7[u6+4],7,-176418897),i4=c4(i4,n5,r6,o6,e7[u6+5],12,1200080426),o6=c4(o6,i4,n5,r6,e7[u6+6],17,-1473231341),r6=c4(r6,o6,i4,n5,e7[u6+7],22,-45705983),n5=c4(n5,r6,o6,i4,e7[u6+8],7,1770035416),i4=c4(i4,n5,r6,o6,e7[u6+9],12,-1958414417),o6=c4(o6,i4,n5,r6,e7[u6+10],17,-42063),r6=c4(r6,o6,i4,n5,e7[u6+11],22,-1990404162),n5=c4(n5,r6,o6,i4,e7[u6+12],7,1804603682),i4=c4(i4,n5,r6,o6,e7[u6+13],12,-40341101),o6=c4(o6,i4,n5,r6,e7[u6+14],17,-1502002290),n5=d4(n5,r6=c4(r6,o6,i4,n5,e7[u6+15],22,1236535329),o6,i4,e7[u6+1],5,-165796510),i4=d4(i4,n5,r6,o6,e7[u6+6],9,-1069501632),o6=d4(o6,i4,n5,r6,e7[u6+11],14,643717713),r6=d4(r6,o6,i4,n5,e7[u6+0],20,-373897302),n5=d4(n5,r6,o6,i4,e7[u6+5],5,-701558691),i4=d4(i4,n5,r6,o6,e7[u6+10],9,38016083),o6=d4(o6,i4,n5,r6,e7[u6+15],14,-660478335),r6=d4(r6,o6,i4,n5,e7[u6+4],20,-405537848),n5=d4(n5,r6,o6,i4,e7[u6+9],5,568446438),i4=d4(i4,n5,r6,o6,e7[u6+14],9,-1019803690),o6=d4(o6,i4,n5,r6,e7[u6+3],14,-187363961),r6=d4(r6,o6,i4,n5,e7[u6+8],20,1163531501),n5=d4(n5,r6,o6,i4,e7[u6+13],5,-1444681467),i4=d4(i4,n5,r6,o6,e7[u6+2],9,-51403784),o6=d4(o6,i4,n5,r6,e7[u6+7],14,1735328473),n5=h6(n5,r6=d4(r6,o6,i4,n5,e7[u6+12],20,-1926607734),o6,i4,e7[u6+5],4,-378558),i4=h6(i4,n5,r6,o6,e7[u6+8],11,-2022574463),o6=h6(o6,i4,n5,r6,e7[u6+11],16,1839030562),r6=h6(r6,o6,i4,n5,e7[u6+14],23,-35309556),n5=h6(n5,r6,o6,i4,e7[u6+1],4,-1530992060),i4=h6(i4,n5,r6,o6,e7[u6+4],11,1272893353),o6=h6(o6,i4,n5,r6,e7[u6+7],16,-155497632),r6=h6(r6,o6,i4,n5,e7[u6+10],23,-1094730640),n5=h6(n5,r6,o6,i4,e7[u6+13],4,681279174),i4=h6(i4,n5,r6,o6,e7[u6+0],11,-358537222),o6=h6(o6,i4,n5,r6,e7[u6+3],16,-722521979),r6=h6(r6,o6,i4,n5,e7[u6+6],23,76029189),n5=h6(n5,r6,o6,i4,e7[u6+9],4,-640364487),i4=h6(i4,n5,r6,o6,e7[u6+12],11,-421815835),o6=h6(o6,i4,n5,r6,e7[u6+15],16,530742520),n5=p4(n5,r6=h6(r6,o6,i4,n5,e7[u6+2],23,-995338651),o6,i4,e7[u6+0],6,-198630844),i4=p4(i4,n5,r6,o6,e7[u6+7],10,1126891415),o6=p4(o6,i4,n5,r6,e7[u6+14],15,-1416354905),r6=p4(r6,o6,i4,n5,e7[u6+5],21,-57434055),n5=p4(n5,r6,o6,i4,e7[u6+12],6,1700485571),i4=p4(i4,n5,r6,o6,e7[u6+3],10,-1894986606),o6=p4(o6,i4,n5,r6,e7[u6+10],15,-1051523),r6=p4(r6,o6,i4,n5,e7[u6+1],21,-2054922799),n5=p4(n5,r6,o6,i4,e7[u6+8],6,1873313359),i4=p4(i4,n5,r6,o6,e7[u6+15],10,-30611744),o6=p4(o6,i4,n5,r6,e7[u6+6],15,-1560198380),r6=p4(r6,o6,i4,n5,e7[u6+13],21,1309151649),n5=p4(n5,r6,o6,i4,e7[u6+4],6,-145523070),i4=p4(i4,n5,r6,o6,e7[u6+11],10,-1120210379),o6=p4(o6,i4,n5,r6,e7[u6+2],15,718787259),r6=p4(r6,o6,i4,n5,e7[u6+9],21,-343485551),n5=g6(n5,s4),r6=g6(r6,a4),o6=g6(o6,f4),i4=g6(i4,l5)}return Array(n5,r6,o6,i4)}function s3(e7,t53,n5,r6,o6,i4){return g6((t53=g6(g6(t53,e7),g6(r6,i4)))<<o6|t53>>>32-o6,n5)}function c4(e7,t53,n5,r6,o6,i4,u6){return s3(t53&n5|~t53&r6,e7,t53,o6,i4,u6)}function d4(e7,t53,n5,r6,o6,i4,u6){return s3(t53&r6|n5&~r6,e7,t53,o6,i4,u6)}function h6(e7,t53,n5,r6,o6,i4,u6){return s3(t53^n5^r6,e7,t53,o6,i4,u6)}function p4(e7,t53,n5,r6,o6,i4,u6){return s3(n5^(t53|~r6),e7,t53,o6,i4,u6)}function g6(e7,t53){var n5=(65535&e7)+(65535&t53);return(e7>>16)+(t53>>16)+(n5>>16)<<16|65535&n5}b3.exports=function(e7){return t52.hash(e7,n4,16)}}).call(this,w4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},w4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e5,l4,t52){(function(e6,t53,n4,r5,o4,i3,u5,s3,f3){var a3;l4.exports=a3||function(e7){for(var t54,n5=new Array(e7),r6=0;r6<e7;r6++)(3&r6)==0&&(t54=4294967296*Math.random()),n5[r6]=t54>>>((3&r6)<<3)&255;return n5}}).call(this,e5("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e5("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(c4,d4,e5){(function(e6,t52,n4,r5,o4,s3,a3,f3,l4){var i3=c4("./helpers");function u5(l5,c5){l5[c5>>5]|=128<<24-c5%32,l5[15+(c5+64>>9<<4)]=c5;for(var e7,t53,n5,r6=Array(80),o6=1732584193,i4=-271733879,u6=-1732584194,s4=271733878,d5=-1009589776,h6=0;h6<l5.length;h6+=16){for(var p4=o6,g6=i4,y4=u6,w4=s4,b3=d5,a4=0;a4<80;a4++){r6[a4]=a4<16?l5[h6+a4]:v4(r6[a4-3]^r6[a4-8]^r6[a4-14]^r6[a4-16],1);var f4=m4(m4(v4(o6,5),(f4=i4,t53=u6,n5=s4,(e7=a4)<20?f4&t53|~f4&n5:!(e7<40)&&e7<60?f4&t53|f4&n5|t53&n5:f4^t53^n5)),m4(m4(d5,r6[a4]),(e7=a4)<20?1518500249:e7<40?1859775393:e7<60?-1894007588:-899497514)),d5=s4,s4=u6,u6=v4(i4,30),i4=o6,o6=f4}o6=m4(o6,p4),i4=m4(i4,g6),u6=m4(u6,y4),s4=m4(s4,w4),d5=m4(d5,b3)}return Array(o6,i4,u6,s4,d5)}function m4(e7,t53){var n5=(65535&e7)+(65535&t53);return(e7>>16)+(t53>>16)+(n5>>16)<<16|65535&n5}function v4(e7,t53){return e7<<t53|e7>>>32-t53}d4.exports=function(e7){return i3.hash(e7,u5,20,!0)}}).call(this,c4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},c4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(c4,d4,e5){(function(e6,t52,n4,r5,u5,s3,a3,f3,l4){function b3(e7,t53){var n5=(65535&e7)+(65535&t53);return(e7>>16)+(t53>>16)+(n5>>16)<<16|65535&n5}function o4(e7,l5){var c5,d5=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),t53=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),n5=new Array(64);e7[l5>>5]|=128<<24-l5%32,e7[15+(l5+64>>9<<4)]=l5;for(var r6,o6,h6=0;h6<e7.length;h6+=16){for(var i4=t53[0],u6=t53[1],s4=t53[2],p4=t53[3],a4=t53[4],g6=t53[5],y4=t53[6],w4=t53[7],f4=0;f4<64;f4++)n5[f4]=f4<16?e7[f4+h6]:b3(b3(b3((o6=n5[f4-2],m4(o6,17)^m4(o6,19)^v4(o6,10)),n5[f4-7]),(o6=n5[f4-15],m4(o6,7)^m4(o6,18)^v4(o6,3))),n5[f4-16]),c5=b3(b3(b3(b3(w4,m4(o6=a4,6)^m4(o6,11)^m4(o6,25)),a4&g6^~a4&y4),d5[f4]),n5[f4]),r6=b3(m4(r6=i4,2)^m4(r6,13)^m4(r6,22),i4&u6^i4&s4^u6&s4),w4=y4,y4=g6,g6=a4,a4=b3(p4,c5),p4=s4,s4=u6,u6=i4,i4=b3(c5,r6);t53[0]=b3(i4,t53[0]),t53[1]=b3(u6,t53[1]),t53[2]=b3(s4,t53[2]),t53[3]=b3(p4,t53[3]),t53[4]=b3(a4,t53[4]),t53[5]=b3(g6,t53[5]),t53[6]=b3(y4,t53[6]),t53[7]=b3(w4,t53[7])}return t53}var i3=c4("./helpers"),m4=function(e7,t53){return e7>>>t53|e7<<32-t53},v4=function(e7,t53){return e7>>>t53};d4.exports=function(e7){return i3.hash(e7,o4,32,!0)}}).call(this,c4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},c4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e5,t52,f3){(function(e6,t53,n4,r5,o4,i3,u5,s3,a3){f3.read=function(e7,t54,n5,r6,o6){var i4,u6,l4=8*o6-r6-1,c4=(1<<l4)-1,d4=c4>>1,s4=-7,a4=n5?o6-1:0,f4=n5?-1:1,o6=e7[t54+a4];for(a4+=f4,i4=o6&(1<<-s4)-1,o6>>=-s4,s4+=l4;0<s4;i4=256*i4+e7[t54+a4],a4+=f4,s4-=8);for(u6=i4&(1<<-s4)-1,i4>>=-s4,s4+=r6;0<s4;u6=256*u6+e7[t54+a4],a4+=f4,s4-=8);if(i4===0)i4=1-d4;else{if(i4===c4)return u6?NaN:1/0*(o6?-1:1);u6+=Math.pow(2,r6),i4-=d4}return(o6?-1:1)*u6*Math.pow(2,i4-r6)},f3.write=function(e7,t54,l4,n5,r6,c4){var o6,i4,u6=8*c4-r6-1,s4=(1<<u6)-1,a4=s4>>1,d4=r6===23?Math.pow(2,-24)-Math.pow(2,-77):0,f4=n5?0:c4-1,h6=n5?1:-1,c4=t54<0||t54===0&&1/t54<0?1:0;for(t54=Math.abs(t54),isNaN(t54)||t54===1/0?(i4=isNaN(t54)?1:0,o6=s4):(o6=Math.floor(Math.log(t54)/Math.LN2),t54*(n5=Math.pow(2,-o6))<1&&(o6--,n5*=2),2<=(t54+=1<=o6+a4?d4/n5:d4*Math.pow(2,1-a4))*n5&&(o6++,n5/=2),s4<=o6+a4?(i4=0,o6=s4):1<=o6+a4?(i4=(t54*n5-1)*Math.pow(2,r6),o6+=a4):(i4=t54*Math.pow(2,a4-1)*Math.pow(2,r6),o6=0));8<=r6;e7[l4+f4]=255&i4,f4+=h6,i4/=256,r6-=8);for(o6=o6<<r6|i4,u6+=r6;0<u6;e7[l4+f4]=255&o6,f4+=h6,o6/=256,u6-=8);e7[l4+f4-h6]|=128*c4}}).call(this,e5("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e5("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e5,h6,t52){(function(e6,t53,n4,r5,o4,f3,l4,c4,d4){var i3,u5,s3;function a3(){}(e6=h6.exports={}).nextTick=(u5=typeof window<"u"&&window.setImmediate,s3=typeof window<"u"&&window.postMessage&&window.addEventListener,u5?function(e7){return window.setImmediate(e7)}:s3?(i3=[],window.addEventListener("message",function(e7){var t54=e7.source;t54!==window&&t54!==null||e7.data!=="process-tick"||(e7.stopPropagation(),0<i3.length&&i3.shift()())},!0),function(e7){i3.push(e7),window.postMessage("process-tick","*")}):function(e7){setTimeout(e7,0)}),e6.title="browser",e6.browser=!0,e6.env={},e6.argv=[],e6.on=a3,e6.addListener=a3,e6.once=a3,e6.off=a3,e6.removeListener=a3,e6.removeAllListeners=a3,e6.emit=a3,e6.binding=function(e7){throw new Error("process.binding is not supported")},e6.cwd=function(){return"/"},e6.chdir=function(e7){throw new Error("process.chdir is not supported")}}).call(this,e5("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e5("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})}});var require_svgson_umd=__commonJS({"node_modules/svgson/dist/svgson.umd.js"(exports,module){"use strict";(function(global2,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global2=typeof globalThis<"u"?globalThis:global2||self,global2.svgson=factory())})(exports,(function(){"use strict";var isBuffer_1=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer=="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE=="function"&&typeof obj.slice=="function"&&isBuffer(obj.slice(0,0))}var toString2=Object.prototype.toString,kindOf=function(val){if(typeof val>"u")return"undefined";if(val===null)return"null";if(val===!0||val===!1||val instanceof Boolean)return"boolean";if(typeof val=="string"||val instanceof String)return"string";if(typeof val=="number"||val instanceof Number)return"number";if(typeof val=="function"||val instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(val))return"array";if(val instanceof RegExp)return"regexp";if(val instanceof Date)return"date";var type=toString2.call(val);return type==="[object RegExp]"?"regexp":type==="[object Date]"?"date":type==="[object Arguments]"?"arguments":type==="[object Error]"?"error":isBuffer_1(val)?"buffer":type==="[object Set]"?"set":type==="[object WeakSet]"?"weakset":type==="[object Map]"?"map":type==="[object WeakMap]"?"weakmap":type==="[object Symbol]"?"symbol":type==="[object Int8Array]"?"int8array":type==="[object Uint8Array]"?"uint8array":type==="[object Uint8ClampedArray]"?"uint8clampedarray":type==="[object Int16Array]"?"int16array":type==="[object Uint16Array]"?"uint16array":type==="[object Int32Array]"?"int32array":type==="[object Uint32Array]"?"uint32array":type==="[object Float32Array]"?"float32array":type==="[object Float64Array]"?"float64array":"object"};function createCommonjsModule(fn3,module2){return module2={exports:{}},fn3(module2,module2.exports),module2.exports}var renameKeys=createCommonjsModule(function(module2){(function(){function rename(obj,fn3){if(typeof fn3!="function")return obj;var res2={};for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(res2[fn3(key,obj[key])||key]=obj[key]);return res2}module2.exports?module2.exports=rename:window.rename=rename})()}),deepRenameKeys=function renameDeep(obj,cb3){var type=kindOf(obj);if(type!=="object"&&type!=="array")throw new Error("expected an object");var res2=[];type==="object"&&(obj=renameKeys(obj,cb3),res2={});for(var key in obj)if(obj.hasOwnProperty(key)){var val=obj[key];kindOf(val)==="object"||kindOf(val)==="array"?res2[key]=renameDeep(val,cb3):res2[key]=val}return res2},eventemitter3=createCommonjsModule(function(module2){var has=Object.prototype.hasOwnProperty,prefix="~";function Events(){}Object.create&&(Events.prototype=Object.create(null),new Events().__proto__||(prefix=!1));function EE3(fn3,context,once){this.fn=fn3,this.context=context,this.once=once||!1}function EventEmitter(){this._events=new Events,this._eventsCount=0}EventEmitter.prototype.eventNames=function(){var names=[],events,name;if(this._eventsCount===0)return names;for(name in events=this._events)has.call(events,name)&&names.push(prefix?name.slice(1):name);return Object.getOwnPropertySymbols?names.concat(Object.getOwnPropertySymbols(events)):names},EventEmitter.prototype.listeners=function(event,exists){var evt=prefix?prefix+event:event,available=this._events[evt];if(exists)return!!available;if(!available)return[];if(available.fn)return[available.fn];for(var i3=0,l4=available.length,ee3=new Array(l4);i3<l4;i3++)ee3[i3]=available[i3].fn;return ee3},EventEmitter.prototype.emit=function(event,a12,a22,a3,a4,a52){var evt=prefix?prefix+event:event;if(!this._events[evt])return!1;var listeners=this._events[evt],len=arguments.length,args,i3;if(listeners.fn){switch(listeners.once&&this.removeListener(event,listeners.fn,void 0,!0),len){case 1:return listeners.fn.call(listeners.context),!0;case 2:return listeners.fn.call(listeners.context,a12),!0;case 3:return listeners.fn.call(listeners.context,a12,a22),!0;case 4:return listeners.fn.call(listeners.context,a12,a22,a3),!0;case 5:return listeners.fn.call(listeners.context,a12,a22,a3,a4),!0;case 6:return listeners.fn.call(listeners.context,a12,a22,a3,a4,a52),!0}for(i3=1,args=new Array(len-1);i3<len;i3++)args[i3-1]=arguments[i3];listeners.fn.apply(listeners.context,args)}else{var length4=listeners.length,j4;for(i3=0;i3<length4;i3++)switch(listeners[i3].once&&this.removeListener(event,listeners[i3].fn,void 0,!0),len){case 1:listeners[i3].fn.call(listeners[i3].context);break;case 2:listeners[i3].fn.call(listeners[i3].context,a12);break;case 3:listeners[i3].fn.call(listeners[i3].context,a12,a22);break;case 4:listeners[i3].fn.call(listeners[i3].context,a12,a22,a3);break;default:if(!args)for(j4=1,args=new Array(len-1);j4<len;j4++)args[j4-1]=arguments[j4];listeners[i3].fn.apply(listeners[i3].context,args)}}return!0},EventEmitter.prototype.on=function(event,fn3,context){var listener=new EE3(fn3,context||this),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.once=function(event,fn3,context){var listener=new EE3(fn3,context||this,!0),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.removeListener=function(event,fn3,context,once){var evt=prefix?prefix+event:event;if(!this._events[evt])return this;if(!fn3)return--this._eventsCount===0?this._events=new Events:delete this._events[evt],this;var listeners=this._events[evt];if(listeners.fn)listeners.fn===fn3&&(!once||listeners.once)&&(!context||listeners.context===context)&&(--this._eventsCount===0?this._events=new Events:delete this._events[evt]);else{for(var i3=0,events=[],length4=listeners.length;i3<length4;i3++)(listeners[i3].fn!==fn3||once&&!listeners[i3].once||context&&listeners[i3].context!==context)&&events.push(listeners[i3]);events.length?this._events[evt]=events.length===1?events[0]:events:--this._eventsCount===0?this._events=new Events:delete this._events[evt]}return this},EventEmitter.prototype.removeAllListeners=function(event){var evt;return event?(evt=prefix?prefix+event:event,this._events[evt]&&(--this._eventsCount===0?this._events=new Events:delete this._events[evt])):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prototype.setMaxListeners=function(){return this},EventEmitter.prefixed=prefix,EventEmitter.EventEmitter=EventEmitter,module2.exports=EventEmitter});function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}var noop=function(){},State2={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},Action={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},Type$1={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},charToAction={" ":Action.space," ":Action.space,"\n":Action.space,"\r":Action.space,"<":Action.lt,">":Action.gt,'"':Action.quote,"'":Action.quote,"=":Action.equal,"/":Action.slash},getAction=function(char){return charToAction[char]||Action.char},create$1=function(options){var _State$data,_State$tagBegin,_State$tagName,_State$tagEnd,_State$attributeNameS,_State$attributeName,_State$attributeNameE,_State$attributeValue,_State$attributeValue2,_lexer$stateMachine;options=Object.assign({debug:!1},options);var lexer2=new eventemitter3,state2=State2.data,data="",tagName="",attrName="",attrValue="",isClosing="",openingQuote="",emit=function(type,value){if(!(tagName[0]==="?"||tagName[0]==="!")){var event={type,value};options.debug&&console.log("emit:",event),lexer2.emit("data",event)}};lexer2.stateMachine=(_lexer$stateMachine={},_defineProperty(_lexer$stateMachine,State2.data,(_State$data={},_defineProperty(_State$data,Action.lt,function(){data.trim()&&emit(Type$1.text,data),tagName="",isClosing=!1,state2=State2.tagBegin}),_defineProperty(_State$data,Action.char,function(char){data+=char}),_State$data)),_defineProperty(_lexer$stateMachine,State2.cdata,_defineProperty({},Action.char,function(char){data+=char,data.substr(-3)==="]]>"&&(emit(Type$1.text,data.slice(0,-3)),data="",state2=State2.data)})),_defineProperty(_lexer$stateMachine,State2.tagBegin,(_State$tagBegin={},_defineProperty(_State$tagBegin,Action.space,noop),_defineProperty(_State$tagBegin,Action.char,function(char){tagName=char,state2=State2.tagName}),_defineProperty(_State$tagBegin,Action.slash,function(){tagName="",isClosing=!0}),_State$tagBegin)),_defineProperty(_lexer$stateMachine,State2.tagName,(_State$tagName={},_defineProperty(_State$tagName,Action.space,function(){isClosing?state2=State2.tagEnd:(state2=State2.attributeNameStart,emit(Type$1.openTag,tagName))}),_defineProperty(_State$tagName,Action.gt,function(){emit(isClosing?Type$1.closeTag:Type$1.openTag,tagName),data="",state2=State2.data}),_defineProperty(_State$tagName,Action.slash,function(){state2=State2.tagEnd,emit(Type$1.openTag,tagName)}),_defineProperty(_State$tagName,Action.char,function(char){tagName+=char,tagName==="![CDATA["&&(state2=State2.cdata,data="",tagName="")}),_State$tagName)),_defineProperty(_lexer$stateMachine,State2.tagEnd,(_State$tagEnd={},_defineProperty(_State$tagEnd,Action.gt,function(){emit(Type$1.closeTag,tagName),data="",state2=State2.data}),_defineProperty(_State$tagEnd,Action.char,noop),_State$tagEnd)),_defineProperty(_lexer$stateMachine,State2.attributeNameStart,(_State$attributeNameS={},_defineProperty(_State$attributeNameS,Action.char,function(char){attrName=char,state2=State2.attributeName}),_defineProperty(_State$attributeNameS,Action.gt,function(){data="",state2=State2.data}),_defineProperty(_State$attributeNameS,Action.space,noop),_defineProperty(_State$attributeNameS,Action.slash,function(){isClosing=!0,state2=State2.tagEnd}),_State$attributeNameS)),_defineProperty(_lexer$stateMachine,State2.attributeName,(_State$attributeName={},_defineProperty(_State$attributeName,Action.space,function(){state2=State2.attributeNameEnd}),_defineProperty(_State$attributeName,Action.equal,function(){emit(Type$1.attributeName,attrName),state2=State2.attributeValueBegin}),_defineProperty(_State$attributeName,Action.gt,function(){attrValue="",emit(Type$1.attributeName,attrName),emit(Type$1.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeName,Action.slash,function(){isClosing=!0,attrValue="",emit(Type$1.attributeName,attrName),emit(Type$1.attributeValue,attrValue),state2=State2.tagEnd}),_defineProperty(_State$attributeName,Action.char,function(char){attrName+=char}),_State$attributeName)),_defineProperty(_lexer$stateMachine,State2.attributeNameEnd,(_State$attributeNameE={},_defineProperty(_State$attributeNameE,Action.space,noop),_defineProperty(_State$attributeNameE,Action.equal,function(){emit(Type$1.attributeName,attrName),state2=State2.attributeValueBegin}),_defineProperty(_State$attributeNameE,Action.gt,function(){attrValue="",emit(Type$1.attributeName,attrName),emit(Type$1.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeNameE,Action.char,function(char){attrValue="",emit(Type$1.attributeName,attrName),emit(Type$1.attributeValue,attrValue),attrName=char,state2=State2.attributeName}),_State$attributeNameE)),_defineProperty(_lexer$stateMachine,State2.attributeValueBegin,(_State$attributeValue={},_defineProperty(_State$attributeValue,Action.space,noop),_defineProperty(_State$attributeValue,Action.quote,function(char){openingQuote=char,attrValue="",state2=State2.attributeValue}),_defineProperty(_State$attributeValue,Action.gt,function(){attrValue="",emit(Type$1.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeValue,Action.char,function(char){openingQuote="",attrValue=char,state2=State2.attributeValue}),_State$attributeValue)),_defineProperty(_lexer$stateMachine,State2.attributeValue,(_State$attributeValue2={},_defineProperty(_State$attributeValue2,Action.space,function(char){openingQuote?attrValue+=char:(emit(Type$1.attributeValue,attrValue),state2=State2.attributeNameStart)}),_defineProperty(_State$attributeValue2,Action.quote,function(char){openingQuote===char?(emit(Type$1.attributeValue,attrValue),state2=State2.attributeNameStart):attrValue+=char}),_defineProperty(_State$attributeValue2,Action.gt,function(char){openingQuote?attrValue+=char:(emit(Type$1.attributeValue,attrValue),data="",state2=State2.data)}),_defineProperty(_State$attributeValue2,Action.slash,function(char){openingQuote?attrValue+=char:(emit(Type$1.attributeValue,attrValue),isClosing=!0,state2=State2.tagEnd)}),_defineProperty(_State$attributeValue2,Action.char,function(char){attrValue+=char}),_State$attributeValue2)),_lexer$stateMachine);var step=function(char){options.debug&&console.log(state2,char);var actions=lexer2.stateMachine[state2],action=actions[getAction(char)]||actions[Action.error]||actions[Action.char];action(char)};return lexer2.write=function(str){for(var len=str.length,i3=0;i3<len;i3++)step(str[i3])},lexer2},lexer={State:State2,Action,Type:Type$1,create:create$1},Type=lexer.Type,NodeType={element:"element",text:"text"},createNode=function(params){return Object.assign({name:"",type:NodeType.element,value:"",parent:null,attributes:{},children:[]},params)},create=function(options){options=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},options);var lexer$1=void 0,rootNode=void 0,current3=void 0,attrName=void 0,reader2=new eventemitter3,handleLexerData=function(data){switch(data.type){case Type.openTag:if(current3===null)current3=rootNode,current3.name=data.value;else{var node=createNode({name:data.value,parent:current3});current3.children.push(node),current3=node}break;case Type.closeTag:var parent=current3.parent;if(options.parentNodes||(current3.parent=null),current3.name!==data.value)break;options.stream&&parent===rootNode&&(rootNode.children=[],current3.parent=null),(!options.emitTopLevelOnly||parent===rootNode)&&(reader2.emit(options.tagPrefix+current3.name,current3),reader2.emit("tag",current3.name,current3)),current3===rootNode&&(lexer$1.removeAllListeners("data"),reader2.emit(options.doneEvent,current3),rootNode=null),current3=parent;break;case Type.text:current3&¤t3.children.push(createNode({type:NodeType.text,value:data.value,parent:options.parentNodes?current3:null}));break;case Type.attributeName:attrName=data.value,current3.attributes[attrName]="";break;case Type.attributeValue:current3.attributes[attrName]=data.value;break}};return reader2.reset=function(){lexer$1=lexer.create({debug:options.debug}),lexer$1.on("data",handleLexerData),rootNode=createNode(),current3=null,attrName="",reader2.parse=lexer$1.write},reader2.reset(),reader2},parseSync=function(xml,options){options=Object.assign({},options,{stream:!1,tagPrefix:":"});var reader2=create(options),res2=void 0;return reader2.on("done",function(ast){res2=ast}),reader2.parse(xml),res2},reader={parseSync,create,NodeType},reader_1=reader.parseSync,parseInput=function(input2){var parsed=reader_1("<root>".concat(input2,"</root>"),{parentNodes:!1}),isValid3=parsed.children&&parsed.children.length>0&&parsed.children.every(function(node){return node.name==="svg"});if(isValid3)return parsed.children.length===1?parsed.children[0]:parsed.children;throw Error("nothing to parse")},camelize=function(node){return deepRenameKeys(node,function(key){return notCamelcase(key)?key:toCamelCase(key)})},toCamelCase=function(prop){return prop.replace(/[-|:]([a-z])/gi,function(all,letter){return letter.toUpperCase()})},notCamelcase=function(prop){return/^(data|aria)(-\w+)/.test(prop)},escapeText2=function(text){if(text){var str=String(text);return/[&<>]/.test(str)?"<![CDATA[".concat(str.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):str}return""},escapeAttr=function(attr){return String(attr).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},svgsonSync=function(input2){var _ref=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_ref$transformNode=_ref.transformNode,transformNode=_ref$transformNode===void 0?function(node){return node}:_ref$transformNode,_ref$camelcase=_ref.camelcase,camelcase=_ref$camelcase===void 0?!1:_ref$camelcase,applyFilters=function(input3){var n4;return n4=transformNode(input3),camelcase&&(n4=camelize(n4)),n4};return applyFilters(parseInput(input2))};function svgson(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return new Promise(function(resolve,reject){try{var res2=svgsonSync.apply(void 0,args);resolve(res2)}catch(e5){reject(e5)}})}var stringify8=function stringify9(_ast){var _ref=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_ref$transformAttr=_ref.transformAttr,transformAttr=_ref$transformAttr===void 0?function(key,value,escape2){return"".concat(key,'="').concat(escape2(value),'"')}:_ref$transformAttr,_ref$transformNode=_ref.transformNode,transformNode=_ref$transformNode===void 0?function(node){return node}:_ref$transformNode,_ref$selfClose=_ref.selfClose,selfClose=_ref$selfClose===void 0?!0:_ref$selfClose;if(Array.isArray(_ast))return _ast.map(function(ast2){return stringify9(ast2,{transformAttr,selfClose,transformNode})}).join("");var ast=transformNode(_ast);if(ast.type==="text")return escapeText2(ast.value);var attributes2="";for(var attr in ast.attributes){var attrStr=transformAttr(attr,ast.attributes[attr],escapeAttr,ast.name);attributes2+=attrStr?" ".concat(attrStr):""}return ast.children&&ast.children.length>0||!selfClose?"<".concat(ast.name).concat(attributes2,">").concat(stringify9(ast.children,{transformAttr,transformNode,selfClose}),"</").concat(ast.name,">"):"<".concat(ast.name).concat(attributes2,"/>")},indexUmd=Object.assign({},{parse:svgson,parseSync:svgsonSync,stringify:stringify8});return indexUmd}))}});var require_react_jsx_runtime_development=__commonJS({"node_modules/react/cjs/react-jsx-runtime.development.js"(exports){"use strict";(function(){function getComponentNameFromType(type){if(type==null)return null;if(typeof type=="function")return type.$$typeof===REACT_CLIENT_REFERENCE?null:type.displayName||type.name||null;if(typeof type=="string")return type;switch(type){case REACT_FRAGMENT_TYPE:return"Fragment";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";case REACT_ACTIVITY_TYPE:return"Activity"}if(typeof type=="object")switch(typeof type.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),type.$$typeof){case REACT_PORTAL_TYPE:return"Portal";case REACT_CONTEXT_TYPE:return type.displayName||"Context";case REACT_CONSUMER_TYPE:return(type._context.displayName||"Context")+".Consumer";case REACT_FORWARD_REF_TYPE:var innerType=type.render;return type=type.displayName,type||(type=innerType.displayName||innerType.name||"",type=type!==""?"ForwardRef("+type+")":"ForwardRef"),type;case REACT_MEMO_TYPE:return innerType=type.displayName||null,innerType!==null?innerType:getComponentNameFromType(type.type)||"Memo";case REACT_LAZY_TYPE:innerType=type._payload,type=type._init;try{return getComponentNameFromType(type(innerType))}catch{}}return null}function testStringCoercion(value){return""+value}function checkKeyStringCoercion(value){try{testStringCoercion(value);var JSCompiler_inline_result=!1}catch{JSCompiler_inline_result=!0}if(JSCompiler_inline_result){JSCompiler_inline_result=console;var JSCompiler_temp_const=JSCompiler_inline_result.error,JSCompiler_inline_result$jscomp$0=typeof Symbol=="function"&&Symbol.toStringTag&&value[Symbol.toStringTag]||value.constructor.name||"Object";return JSCompiler_temp_const.call(JSCompiler_inline_result,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",JSCompiler_inline_result$jscomp$0),testStringCoercion(value)}}function getTaskName(type){if(type===REACT_FRAGMENT_TYPE)return"<>";if(typeof type=="object"&&type!==null&&type.$$typeof===REACT_LAZY_TYPE)return"<...>";try{var name=getComponentNameFromType(type);return name?"<"+name+">":"<...>"}catch{return"<...>"}}function getOwner(){var dispatcher=ReactSharedInternals.A;return dispatcher===null?null:dispatcher.getOwner()}function UnknownOwner(){return Error("react-stack-top-frame")}function hasValidKey(config){if(hasOwnProperty.call(config,"key")){var getter=Object.getOwnPropertyDescriptor(config,"key").get;if(getter&&getter.isReactWarning)return!1}return config.key!==void 0}function defineKeyPropWarningGetter(props,displayName){function warnAboutAccessingKey(){specialPropKeyWarningShown||(specialPropKeyWarningShown=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",displayName))}warnAboutAccessingKey.isReactWarning=!0,Object.defineProperty(props,"key",{get:warnAboutAccessingKey,configurable:!0})}function elementRefGetterWithDeprecationWarning(){var componentName=getComponentNameFromType(this.type);return didWarnAboutElementRef[componentName]||(didWarnAboutElementRef[componentName]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),componentName=this.props.ref,componentName!==void 0?componentName:null}function ReactElement(type,key,props,owner,debugStack,debugTask){var refProp=props.ref;return type={$$typeof:REACT_ELEMENT_TYPE,type,key,props,_owner:owner},(refProp!==void 0?refProp:null)!==null?Object.defineProperty(type,"ref",{enumerable:!1,get:elementRefGetterWithDeprecationWarning}):Object.defineProperty(type,"ref",{enumerable:!1,value:null}),type._store={},Object.defineProperty(type._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(type,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(type,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:debugStack}),Object.defineProperty(type,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:debugTask}),Object.freeze&&(Object.freeze(type.props),Object.freeze(type)),type}function jsxDEVImpl(type,config,maybeKey,isStaticChildren,debugStack,debugTask){var children=config.children;if(children!==void 0)if(isStaticChildren)if(isArrayImpl(children)){for(isStaticChildren=0;isStaticChildren<children.length;isStaticChildren++)validateChildKeys(children[isStaticChildren]);Object.freeze&&Object.freeze(children)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else validateChildKeys(children);if(hasOwnProperty.call(config,"key")){children=getComponentNameFromType(type);var keys=Object.keys(config).filter(function(k4){return k4!=="key"});isStaticChildren=0<keys.length?"{key: someKey, "+keys.join(": ..., ")+": ...}":"{key: someKey}",didWarnAboutKeySpread[children+isStaticChildren]||(keys=0<keys.length?"{"+keys.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
215
|
+
`))}a3.fill(0),_4.createHash=function(e7){return r5(e7)},_4.createHmac=r5,_4.randomBytes=function(e7,t53){if(!t53||!t53.call)return new u5(n4(e7));try{t53.call(this,void 0,new u5(n4(e7)))}catch(e8){t53(e8)}};var o4,f3=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],m4=function(e7){_4[e7]=function(){i3("sorry,",e7,"is not implemented yet")}};for(o4 in f3)m4(f3[o4],o4)}).call(this,v4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},v4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(w4,b3,e5){(function(e6,r5,o4,i3,u5,a3,f3,l4,y4){var t52=w4("./helpers");function n4(e7,t53){e7[t53>>5]|=128<<t53%32,e7[14+(t53+64>>>9<<4)]=t53;for(var n5=1732584193,r6=-271733879,o6=-1732584194,i4=271733878,u6=0;u6<e7.length;u6+=16){var s4=n5,a4=r6,f4=o6,l5=i4,n5=c4(n5,r6,o6,i4,e7[u6+0],7,-680876936),i4=c4(i4,n5,r6,o6,e7[u6+1],12,-389564586),o6=c4(o6,i4,n5,r6,e7[u6+2],17,606105819),r6=c4(r6,o6,i4,n5,e7[u6+3],22,-1044525330);n5=c4(n5,r6,o6,i4,e7[u6+4],7,-176418897),i4=c4(i4,n5,r6,o6,e7[u6+5],12,1200080426),o6=c4(o6,i4,n5,r6,e7[u6+6],17,-1473231341),r6=c4(r6,o6,i4,n5,e7[u6+7],22,-45705983),n5=c4(n5,r6,o6,i4,e7[u6+8],7,1770035416),i4=c4(i4,n5,r6,o6,e7[u6+9],12,-1958414417),o6=c4(o6,i4,n5,r6,e7[u6+10],17,-42063),r6=c4(r6,o6,i4,n5,e7[u6+11],22,-1990404162),n5=c4(n5,r6,o6,i4,e7[u6+12],7,1804603682),i4=c4(i4,n5,r6,o6,e7[u6+13],12,-40341101),o6=c4(o6,i4,n5,r6,e7[u6+14],17,-1502002290),n5=d4(n5,r6=c4(r6,o6,i4,n5,e7[u6+15],22,1236535329),o6,i4,e7[u6+1],5,-165796510),i4=d4(i4,n5,r6,o6,e7[u6+6],9,-1069501632),o6=d4(o6,i4,n5,r6,e7[u6+11],14,643717713),r6=d4(r6,o6,i4,n5,e7[u6+0],20,-373897302),n5=d4(n5,r6,o6,i4,e7[u6+5],5,-701558691),i4=d4(i4,n5,r6,o6,e7[u6+10],9,38016083),o6=d4(o6,i4,n5,r6,e7[u6+15],14,-660478335),r6=d4(r6,o6,i4,n5,e7[u6+4],20,-405537848),n5=d4(n5,r6,o6,i4,e7[u6+9],5,568446438),i4=d4(i4,n5,r6,o6,e7[u6+14],9,-1019803690),o6=d4(o6,i4,n5,r6,e7[u6+3],14,-187363961),r6=d4(r6,o6,i4,n5,e7[u6+8],20,1163531501),n5=d4(n5,r6,o6,i4,e7[u6+13],5,-1444681467),i4=d4(i4,n5,r6,o6,e7[u6+2],9,-51403784),o6=d4(o6,i4,n5,r6,e7[u6+7],14,1735328473),n5=h6(n5,r6=d4(r6,o6,i4,n5,e7[u6+12],20,-1926607734),o6,i4,e7[u6+5],4,-378558),i4=h6(i4,n5,r6,o6,e7[u6+8],11,-2022574463),o6=h6(o6,i4,n5,r6,e7[u6+11],16,1839030562),r6=h6(r6,o6,i4,n5,e7[u6+14],23,-35309556),n5=h6(n5,r6,o6,i4,e7[u6+1],4,-1530992060),i4=h6(i4,n5,r6,o6,e7[u6+4],11,1272893353),o6=h6(o6,i4,n5,r6,e7[u6+7],16,-155497632),r6=h6(r6,o6,i4,n5,e7[u6+10],23,-1094730640),n5=h6(n5,r6,o6,i4,e7[u6+13],4,681279174),i4=h6(i4,n5,r6,o6,e7[u6+0],11,-358537222),o6=h6(o6,i4,n5,r6,e7[u6+3],16,-722521979),r6=h6(r6,o6,i4,n5,e7[u6+6],23,76029189),n5=h6(n5,r6,o6,i4,e7[u6+9],4,-640364487),i4=h6(i4,n5,r6,o6,e7[u6+12],11,-421815835),o6=h6(o6,i4,n5,r6,e7[u6+15],16,530742520),n5=p4(n5,r6=h6(r6,o6,i4,n5,e7[u6+2],23,-995338651),o6,i4,e7[u6+0],6,-198630844),i4=p4(i4,n5,r6,o6,e7[u6+7],10,1126891415),o6=p4(o6,i4,n5,r6,e7[u6+14],15,-1416354905),r6=p4(r6,o6,i4,n5,e7[u6+5],21,-57434055),n5=p4(n5,r6,o6,i4,e7[u6+12],6,1700485571),i4=p4(i4,n5,r6,o6,e7[u6+3],10,-1894986606),o6=p4(o6,i4,n5,r6,e7[u6+10],15,-1051523),r6=p4(r6,o6,i4,n5,e7[u6+1],21,-2054922799),n5=p4(n5,r6,o6,i4,e7[u6+8],6,1873313359),i4=p4(i4,n5,r6,o6,e7[u6+15],10,-30611744),o6=p4(o6,i4,n5,r6,e7[u6+6],15,-1560198380),r6=p4(r6,o6,i4,n5,e7[u6+13],21,1309151649),n5=p4(n5,r6,o6,i4,e7[u6+4],6,-145523070),i4=p4(i4,n5,r6,o6,e7[u6+11],10,-1120210379),o6=p4(o6,i4,n5,r6,e7[u6+2],15,718787259),r6=p4(r6,o6,i4,n5,e7[u6+9],21,-343485551),n5=g6(n5,s4),r6=g6(r6,a4),o6=g6(o6,f4),i4=g6(i4,l5)}return Array(n5,r6,o6,i4)}function s3(e7,t53,n5,r6,o6,i4){return g6((t53=g6(g6(t53,e7),g6(r6,i4)))<<o6|t53>>>32-o6,n5)}function c4(e7,t53,n5,r6,o6,i4,u6){return s3(t53&n5|~t53&r6,e7,t53,o6,i4,u6)}function d4(e7,t53,n5,r6,o6,i4,u6){return s3(t53&r6|n5&~r6,e7,t53,o6,i4,u6)}function h6(e7,t53,n5,r6,o6,i4,u6){return s3(t53^n5^r6,e7,t53,o6,i4,u6)}function p4(e7,t53,n5,r6,o6,i4,u6){return s3(n5^(t53|~r6),e7,t53,o6,i4,u6)}function g6(e7,t53){var n5=(65535&e7)+(65535&t53);return(e7>>16)+(t53>>16)+(n5>>16)<<16|65535&n5}b3.exports=function(e7){return t52.hash(e7,n4,16)}}).call(this,w4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},w4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e5,l4,t52){(function(e6,t53,n4,r5,o4,i3,u5,s3,f3){var a3;l4.exports=a3||function(e7){for(var t54,n5=new Array(e7),r6=0;r6<e7;r6++)(3&r6)==0&&(t54=4294967296*Math.random()),n5[r6]=t54>>>((3&r6)<<3)&255;return n5}}).call(this,e5("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e5("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(c4,d4,e5){(function(e6,t52,n4,r5,o4,s3,a3,f3,l4){var i3=c4("./helpers");function u5(l5,c5){l5[c5>>5]|=128<<24-c5%32,l5[15+(c5+64>>9<<4)]=c5;for(var e7,t53,n5,r6=Array(80),o6=1732584193,i4=-271733879,u6=-1732584194,s4=271733878,d5=-1009589776,h6=0;h6<l5.length;h6+=16){for(var p4=o6,g6=i4,y4=u6,w4=s4,b3=d5,a4=0;a4<80;a4++){r6[a4]=a4<16?l5[h6+a4]:v4(r6[a4-3]^r6[a4-8]^r6[a4-14]^r6[a4-16],1);var f4=m4(m4(v4(o6,5),(f4=i4,t53=u6,n5=s4,(e7=a4)<20?f4&t53|~f4&n5:!(e7<40)&&e7<60?f4&t53|f4&n5|t53&n5:f4^t53^n5)),m4(m4(d5,r6[a4]),(e7=a4)<20?1518500249:e7<40?1859775393:e7<60?-1894007588:-899497514)),d5=s4,s4=u6,u6=v4(i4,30),i4=o6,o6=f4}o6=m4(o6,p4),i4=m4(i4,g6),u6=m4(u6,y4),s4=m4(s4,w4),d5=m4(d5,b3)}return Array(o6,i4,u6,s4,d5)}function m4(e7,t53){var n5=(65535&e7)+(65535&t53);return(e7>>16)+(t53>>16)+(n5>>16)<<16|65535&n5}function v4(e7,t53){return e7<<t53|e7>>>32-t53}d4.exports=function(e7){return i3.hash(e7,u5,20,!0)}}).call(this,c4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},c4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(c4,d4,e5){(function(e6,t52,n4,r5,u5,s3,a3,f3,l4){function b3(e7,t53){var n5=(65535&e7)+(65535&t53);return(e7>>16)+(t53>>16)+(n5>>16)<<16|65535&n5}function o4(e7,l5){var c5,d5=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),t53=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),n5=new Array(64);e7[l5>>5]|=128<<24-l5%32,e7[15+(l5+64>>9<<4)]=l5;for(var r6,o6,h6=0;h6<e7.length;h6+=16){for(var i4=t53[0],u6=t53[1],s4=t53[2],p4=t53[3],a4=t53[4],g6=t53[5],y4=t53[6],w4=t53[7],f4=0;f4<64;f4++)n5[f4]=f4<16?e7[f4+h6]:b3(b3(b3((o6=n5[f4-2],m4(o6,17)^m4(o6,19)^v4(o6,10)),n5[f4-7]),(o6=n5[f4-15],m4(o6,7)^m4(o6,18)^v4(o6,3))),n5[f4-16]),c5=b3(b3(b3(b3(w4,m4(o6=a4,6)^m4(o6,11)^m4(o6,25)),a4&g6^~a4&y4),d5[f4]),n5[f4]),r6=b3(m4(r6=i4,2)^m4(r6,13)^m4(r6,22),i4&u6^i4&s4^u6&s4),w4=y4,y4=g6,g6=a4,a4=b3(p4,c5),p4=s4,s4=u6,u6=i4,i4=b3(c5,r6);t53[0]=b3(i4,t53[0]),t53[1]=b3(u6,t53[1]),t53[2]=b3(s4,t53[2]),t53[3]=b3(p4,t53[3]),t53[4]=b3(a4,t53[4]),t53[5]=b3(g6,t53[5]),t53[6]=b3(y4,t53[6]),t53[7]=b3(w4,t53[7])}return t53}var i3=c4("./helpers"),m4=function(e7,t53){return e7>>>t53|e7<<32-t53},v4=function(e7,t53){return e7>>>t53};d4.exports=function(e7){return i3.hash(e7,o4,32,!0)}}).call(this,c4("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},c4("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e5,t52,f3){(function(e6,t53,n4,r5,o4,i3,u5,s3,a3){f3.read=function(e7,t54,n5,r6,o6){var i4,u6,l4=8*o6-r6-1,c4=(1<<l4)-1,d4=c4>>1,s4=-7,a4=n5?o6-1:0,f4=n5?-1:1,o6=e7[t54+a4];for(a4+=f4,i4=o6&(1<<-s4)-1,o6>>=-s4,s4+=l4;0<s4;i4=256*i4+e7[t54+a4],a4+=f4,s4-=8);for(u6=i4&(1<<-s4)-1,i4>>=-s4,s4+=r6;0<s4;u6=256*u6+e7[t54+a4],a4+=f4,s4-=8);if(i4===0)i4=1-d4;else{if(i4===c4)return u6?NaN:1/0*(o6?-1:1);u6+=Math.pow(2,r6),i4-=d4}return(o6?-1:1)*u6*Math.pow(2,i4-r6)},f3.write=function(e7,t54,l4,n5,r6,c4){var o6,i4,u6=8*c4-r6-1,s4=(1<<u6)-1,a4=s4>>1,d4=r6===23?Math.pow(2,-24)-Math.pow(2,-77):0,f4=n5?0:c4-1,h6=n5?1:-1,c4=t54<0||t54===0&&1/t54<0?1:0;for(t54=Math.abs(t54),isNaN(t54)||t54===1/0?(i4=isNaN(t54)?1:0,o6=s4):(o6=Math.floor(Math.log(t54)/Math.LN2),t54*(n5=Math.pow(2,-o6))<1&&(o6--,n5*=2),2<=(t54+=1<=o6+a4?d4/n5:d4*Math.pow(2,1-a4))*n5&&(o6++,n5/=2),s4<=o6+a4?(i4=0,o6=s4):1<=o6+a4?(i4=(t54*n5-1)*Math.pow(2,r6),o6+=a4):(i4=t54*Math.pow(2,a4-1)*Math.pow(2,r6),o6=0));8<=r6;e7[l4+f4]=255&i4,f4+=h6,i4/=256,r6-=8);for(o6=o6<<r6|i4,u6+=r6;0<u6;e7[l4+f4]=255&o6,f4+=h6,o6/=256,u6-=8);e7[l4+f4-h6]|=128*c4}}).call(this,e5("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e5("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e5,h6,t52){(function(e6,t53,n4,r5,o4,f3,l4,c4,d4){var i3,u5,s3;function a3(){}(e6=h6.exports={}).nextTick=(u5=typeof window<"u"&&window.setImmediate,s3=typeof window<"u"&&window.postMessage&&window.addEventListener,u5?function(e7){return window.setImmediate(e7)}:s3?(i3=[],window.addEventListener("message",function(e7){var t54=e7.source;t54!==window&&t54!==null||e7.data!=="process-tick"||(e7.stopPropagation(),0<i3.length&&i3.shift()())},!0),function(e7){i3.push(e7),window.postMessage("process-tick","*")}):function(e7){setTimeout(e7,0)}),e6.title="browser",e6.browser=!0,e6.env={},e6.argv=[],e6.on=a3,e6.addListener=a3,e6.once=a3,e6.off=a3,e6.removeListener=a3,e6.removeAllListeners=a3,e6.emit=a3,e6.binding=function(e7){throw new Error("process.binding is not supported")},e6.cwd=function(){return"/"},e6.chdir=function(e7){throw new Error("process.chdir is not supported")}}).call(this,e5("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e5("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})}});var require_svgson_umd=__commonJS({"node_modules/svgson/dist/svgson.umd.js"(exports,module){"use strict";(function(global2,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global2=typeof globalThis<"u"?globalThis:global2||self,global2.svgson=factory())})(exports,(function(){"use strict";var isBuffer_1=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer=="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE=="function"&&typeof obj.slice=="function"&&isBuffer(obj.slice(0,0))}var toString3=Object.prototype.toString,kindOf=function(val){if(typeof val>"u")return"undefined";if(val===null)return"null";if(val===!0||val===!1||val instanceof Boolean)return"boolean";if(typeof val=="string"||val instanceof String)return"string";if(typeof val=="number"||val instanceof Number)return"number";if(typeof val=="function"||val instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(val))return"array";if(val instanceof RegExp)return"regexp";if(val instanceof Date)return"date";var type=toString3.call(val);return type==="[object RegExp]"?"regexp":type==="[object Date]"?"date":type==="[object Arguments]"?"arguments":type==="[object Error]"?"error":isBuffer_1(val)?"buffer":type==="[object Set]"?"set":type==="[object WeakSet]"?"weakset":type==="[object Map]"?"map":type==="[object WeakMap]"?"weakmap":type==="[object Symbol]"?"symbol":type==="[object Int8Array]"?"int8array":type==="[object Uint8Array]"?"uint8array":type==="[object Uint8ClampedArray]"?"uint8clampedarray":type==="[object Int16Array]"?"int16array":type==="[object Uint16Array]"?"uint16array":type==="[object Int32Array]"?"int32array":type==="[object Uint32Array]"?"uint32array":type==="[object Float32Array]"?"float32array":type==="[object Float64Array]"?"float64array":"object"};function createCommonjsModule(fn3,module2){return module2={exports:{}},fn3(module2,module2.exports),module2.exports}var renameKeys=createCommonjsModule(function(module2){(function(){function rename(obj,fn3){if(typeof fn3!="function")return obj;var res2={};for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(res2[fn3(key,obj[key])||key]=obj[key]);return res2}module2.exports?module2.exports=rename:window.rename=rename})()}),deepRenameKeys=function renameDeep(obj,cb3){var type=kindOf(obj);if(type!=="object"&&type!=="array")throw new Error("expected an object");var res2=[];type==="object"&&(obj=renameKeys(obj,cb3),res2={});for(var key in obj)if(obj.hasOwnProperty(key)){var val=obj[key];kindOf(val)==="object"||kindOf(val)==="array"?res2[key]=renameDeep(val,cb3):res2[key]=val}return res2},eventemitter3=createCommonjsModule(function(module2){var has=Object.prototype.hasOwnProperty,prefix="~";function Events(){}Object.create&&(Events.prototype=Object.create(null),new Events().__proto__||(prefix=!1));function EE3(fn3,context,once){this.fn=fn3,this.context=context,this.once=once||!1}function EventEmitter(){this._events=new Events,this._eventsCount=0}EventEmitter.prototype.eventNames=function(){var names=[],events,name;if(this._eventsCount===0)return names;for(name in events=this._events)has.call(events,name)&&names.push(prefix?name.slice(1):name);return Object.getOwnPropertySymbols?names.concat(Object.getOwnPropertySymbols(events)):names},EventEmitter.prototype.listeners=function(event,exists){var evt=prefix?prefix+event:event,available=this._events[evt];if(exists)return!!available;if(!available)return[];if(available.fn)return[available.fn];for(var i3=0,l4=available.length,ee3=new Array(l4);i3<l4;i3++)ee3[i3]=available[i3].fn;return ee3},EventEmitter.prototype.emit=function(event,a12,a22,a3,a4,a52){var evt=prefix?prefix+event:event;if(!this._events[evt])return!1;var listeners=this._events[evt],len=arguments.length,args,i3;if(listeners.fn){switch(listeners.once&&this.removeListener(event,listeners.fn,void 0,!0),len){case 1:return listeners.fn.call(listeners.context),!0;case 2:return listeners.fn.call(listeners.context,a12),!0;case 3:return listeners.fn.call(listeners.context,a12,a22),!0;case 4:return listeners.fn.call(listeners.context,a12,a22,a3),!0;case 5:return listeners.fn.call(listeners.context,a12,a22,a3,a4),!0;case 6:return listeners.fn.call(listeners.context,a12,a22,a3,a4,a52),!0}for(i3=1,args=new Array(len-1);i3<len;i3++)args[i3-1]=arguments[i3];listeners.fn.apply(listeners.context,args)}else{var length4=listeners.length,j4;for(i3=0;i3<length4;i3++)switch(listeners[i3].once&&this.removeListener(event,listeners[i3].fn,void 0,!0),len){case 1:listeners[i3].fn.call(listeners[i3].context);break;case 2:listeners[i3].fn.call(listeners[i3].context,a12);break;case 3:listeners[i3].fn.call(listeners[i3].context,a12,a22);break;case 4:listeners[i3].fn.call(listeners[i3].context,a12,a22,a3);break;default:if(!args)for(j4=1,args=new Array(len-1);j4<len;j4++)args[j4-1]=arguments[j4];listeners[i3].fn.apply(listeners[i3].context,args)}}return!0},EventEmitter.prototype.on=function(event,fn3,context){var listener=new EE3(fn3,context||this),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.once=function(event,fn3,context){var listener=new EE3(fn3,context||this,!0),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.removeListener=function(event,fn3,context,once){var evt=prefix?prefix+event:event;if(!this._events[evt])return this;if(!fn3)return--this._eventsCount===0?this._events=new Events:delete this._events[evt],this;var listeners=this._events[evt];if(listeners.fn)listeners.fn===fn3&&(!once||listeners.once)&&(!context||listeners.context===context)&&(--this._eventsCount===0?this._events=new Events:delete this._events[evt]);else{for(var i3=0,events=[],length4=listeners.length;i3<length4;i3++)(listeners[i3].fn!==fn3||once&&!listeners[i3].once||context&&listeners[i3].context!==context)&&events.push(listeners[i3]);events.length?this._events[evt]=events.length===1?events[0]:events:--this._eventsCount===0?this._events=new Events:delete this._events[evt]}return this},EventEmitter.prototype.removeAllListeners=function(event){var evt;return event?(evt=prefix?prefix+event:event,this._events[evt]&&(--this._eventsCount===0?this._events=new Events:delete this._events[evt])):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prototype.setMaxListeners=function(){return this},EventEmitter.prefixed=prefix,EventEmitter.EventEmitter=EventEmitter,module2.exports=EventEmitter});function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}var noop=function(){},State2={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},Action={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},Type$1={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},charToAction={" ":Action.space," ":Action.space,"\n":Action.space,"\r":Action.space,"<":Action.lt,">":Action.gt,'"':Action.quote,"'":Action.quote,"=":Action.equal,"/":Action.slash},getAction=function(char){return charToAction[char]||Action.char},create$1=function(options){var _State$data,_State$tagBegin,_State$tagName,_State$tagEnd,_State$attributeNameS,_State$attributeName,_State$attributeNameE,_State$attributeValue,_State$attributeValue2,_lexer$stateMachine;options=Object.assign({debug:!1},options);var lexer2=new eventemitter3,state2=State2.data,data="",tagName="",attrName="",attrValue="",isClosing="",openingQuote="",emit=function(type,value){if(!(tagName[0]==="?"||tagName[0]==="!")){var event={type,value};options.debug&&console.log("emit:",event),lexer2.emit("data",event)}};lexer2.stateMachine=(_lexer$stateMachine={},_defineProperty(_lexer$stateMachine,State2.data,(_State$data={},_defineProperty(_State$data,Action.lt,function(){data.trim()&&emit(Type$1.text,data),tagName="",isClosing=!1,state2=State2.tagBegin}),_defineProperty(_State$data,Action.char,function(char){data+=char}),_State$data)),_defineProperty(_lexer$stateMachine,State2.cdata,_defineProperty({},Action.char,function(char){data+=char,data.substr(-3)==="]]>"&&(emit(Type$1.text,data.slice(0,-3)),data="",state2=State2.data)})),_defineProperty(_lexer$stateMachine,State2.tagBegin,(_State$tagBegin={},_defineProperty(_State$tagBegin,Action.space,noop),_defineProperty(_State$tagBegin,Action.char,function(char){tagName=char,state2=State2.tagName}),_defineProperty(_State$tagBegin,Action.slash,function(){tagName="",isClosing=!0}),_State$tagBegin)),_defineProperty(_lexer$stateMachine,State2.tagName,(_State$tagName={},_defineProperty(_State$tagName,Action.space,function(){isClosing?state2=State2.tagEnd:(state2=State2.attributeNameStart,emit(Type$1.openTag,tagName))}),_defineProperty(_State$tagName,Action.gt,function(){emit(isClosing?Type$1.closeTag:Type$1.openTag,tagName),data="",state2=State2.data}),_defineProperty(_State$tagName,Action.slash,function(){state2=State2.tagEnd,emit(Type$1.openTag,tagName)}),_defineProperty(_State$tagName,Action.char,function(char){tagName+=char,tagName==="![CDATA["&&(state2=State2.cdata,data="",tagName="")}),_State$tagName)),_defineProperty(_lexer$stateMachine,State2.tagEnd,(_State$tagEnd={},_defineProperty(_State$tagEnd,Action.gt,function(){emit(Type$1.closeTag,tagName),data="",state2=State2.data}),_defineProperty(_State$tagEnd,Action.char,noop),_State$tagEnd)),_defineProperty(_lexer$stateMachine,State2.attributeNameStart,(_State$attributeNameS={},_defineProperty(_State$attributeNameS,Action.char,function(char){attrName=char,state2=State2.attributeName}),_defineProperty(_State$attributeNameS,Action.gt,function(){data="",state2=State2.data}),_defineProperty(_State$attributeNameS,Action.space,noop),_defineProperty(_State$attributeNameS,Action.slash,function(){isClosing=!0,state2=State2.tagEnd}),_State$attributeNameS)),_defineProperty(_lexer$stateMachine,State2.attributeName,(_State$attributeName={},_defineProperty(_State$attributeName,Action.space,function(){state2=State2.attributeNameEnd}),_defineProperty(_State$attributeName,Action.equal,function(){emit(Type$1.attributeName,attrName),state2=State2.attributeValueBegin}),_defineProperty(_State$attributeName,Action.gt,function(){attrValue="",emit(Type$1.attributeName,attrName),emit(Type$1.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeName,Action.slash,function(){isClosing=!0,attrValue="",emit(Type$1.attributeName,attrName),emit(Type$1.attributeValue,attrValue),state2=State2.tagEnd}),_defineProperty(_State$attributeName,Action.char,function(char){attrName+=char}),_State$attributeName)),_defineProperty(_lexer$stateMachine,State2.attributeNameEnd,(_State$attributeNameE={},_defineProperty(_State$attributeNameE,Action.space,noop),_defineProperty(_State$attributeNameE,Action.equal,function(){emit(Type$1.attributeName,attrName),state2=State2.attributeValueBegin}),_defineProperty(_State$attributeNameE,Action.gt,function(){attrValue="",emit(Type$1.attributeName,attrName),emit(Type$1.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeNameE,Action.char,function(char){attrValue="",emit(Type$1.attributeName,attrName),emit(Type$1.attributeValue,attrValue),attrName=char,state2=State2.attributeName}),_State$attributeNameE)),_defineProperty(_lexer$stateMachine,State2.attributeValueBegin,(_State$attributeValue={},_defineProperty(_State$attributeValue,Action.space,noop),_defineProperty(_State$attributeValue,Action.quote,function(char){openingQuote=char,attrValue="",state2=State2.attributeValue}),_defineProperty(_State$attributeValue,Action.gt,function(){attrValue="",emit(Type$1.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeValue,Action.char,function(char){openingQuote="",attrValue=char,state2=State2.attributeValue}),_State$attributeValue)),_defineProperty(_lexer$stateMachine,State2.attributeValue,(_State$attributeValue2={},_defineProperty(_State$attributeValue2,Action.space,function(char){openingQuote?attrValue+=char:(emit(Type$1.attributeValue,attrValue),state2=State2.attributeNameStart)}),_defineProperty(_State$attributeValue2,Action.quote,function(char){openingQuote===char?(emit(Type$1.attributeValue,attrValue),state2=State2.attributeNameStart):attrValue+=char}),_defineProperty(_State$attributeValue2,Action.gt,function(char){openingQuote?attrValue+=char:(emit(Type$1.attributeValue,attrValue),data="",state2=State2.data)}),_defineProperty(_State$attributeValue2,Action.slash,function(char){openingQuote?attrValue+=char:(emit(Type$1.attributeValue,attrValue),isClosing=!0,state2=State2.tagEnd)}),_defineProperty(_State$attributeValue2,Action.char,function(char){attrValue+=char}),_State$attributeValue2)),_lexer$stateMachine);var step=function(char){options.debug&&console.log(state2,char);var actions=lexer2.stateMachine[state2],action=actions[getAction(char)]||actions[Action.error]||actions[Action.char];action(char)};return lexer2.write=function(str){for(var len=str.length,i3=0;i3<len;i3++)step(str[i3])},lexer2},lexer={State:State2,Action,Type:Type$1,create:create$1},Type=lexer.Type,NodeType={element:"element",text:"text"},createNode=function(params){return Object.assign({name:"",type:NodeType.element,value:"",parent:null,attributes:{},children:[]},params)},create=function(options){options=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},options);var lexer$1=void 0,rootNode=void 0,current3=void 0,attrName=void 0,reader2=new eventemitter3,handleLexerData=function(data){switch(data.type){case Type.openTag:if(current3===null)current3=rootNode,current3.name=data.value;else{var node=createNode({name:data.value,parent:current3});current3.children.push(node),current3=node}break;case Type.closeTag:var parent=current3.parent;if(options.parentNodes||(current3.parent=null),current3.name!==data.value)break;options.stream&&parent===rootNode&&(rootNode.children=[],current3.parent=null),(!options.emitTopLevelOnly||parent===rootNode)&&(reader2.emit(options.tagPrefix+current3.name,current3),reader2.emit("tag",current3.name,current3)),current3===rootNode&&(lexer$1.removeAllListeners("data"),reader2.emit(options.doneEvent,current3),rootNode=null),current3=parent;break;case Type.text:current3&¤t3.children.push(createNode({type:NodeType.text,value:data.value,parent:options.parentNodes?current3:null}));break;case Type.attributeName:attrName=data.value,current3.attributes[attrName]="";break;case Type.attributeValue:current3.attributes[attrName]=data.value;break}};return reader2.reset=function(){lexer$1=lexer.create({debug:options.debug}),lexer$1.on("data",handleLexerData),rootNode=createNode(),current3=null,attrName="",reader2.parse=lexer$1.write},reader2.reset(),reader2},parseSync=function(xml,options){options=Object.assign({},options,{stream:!1,tagPrefix:":"});var reader2=create(options),res2=void 0;return reader2.on("done",function(ast){res2=ast}),reader2.parse(xml),res2},reader={parseSync,create,NodeType},reader_1=reader.parseSync,parseInput=function(input2){var parsed=reader_1("<root>".concat(input2,"</root>"),{parentNodes:!1}),isValid3=parsed.children&&parsed.children.length>0&&parsed.children.every(function(node){return node.name==="svg"});if(isValid3)return parsed.children.length===1?parsed.children[0]:parsed.children;throw Error("nothing to parse")},camelize=function(node){return deepRenameKeys(node,function(key){return notCamelcase(key)?key:toCamelCase(key)})},toCamelCase=function(prop){return prop.replace(/[-|:]([a-z])/gi,function(all,letter){return letter.toUpperCase()})},notCamelcase=function(prop){return/^(data|aria)(-\w+)/.test(prop)},escapeText2=function(text){if(text){var str=String(text);return/[&<>]/.test(str)?"<![CDATA[".concat(str.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):str}return""},escapeAttr=function(attr){return String(attr).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},svgsonSync=function(input2){var _ref=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_ref$transformNode=_ref.transformNode,transformNode=_ref$transformNode===void 0?function(node){return node}:_ref$transformNode,_ref$camelcase=_ref.camelcase,camelcase=_ref$camelcase===void 0?!1:_ref$camelcase,applyFilters=function(input3){var n4;return n4=transformNode(input3),camelcase&&(n4=camelize(n4)),n4};return applyFilters(parseInput(input2))};function svgson(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return new Promise(function(resolve,reject){try{var res2=svgsonSync.apply(void 0,args);resolve(res2)}catch(e5){reject(e5)}})}var stringify8=function stringify9(_ast){var _ref=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_ref$transformAttr=_ref.transformAttr,transformAttr=_ref$transformAttr===void 0?function(key,value,escape2){return"".concat(key,'="').concat(escape2(value),'"')}:_ref$transformAttr,_ref$transformNode=_ref.transformNode,transformNode=_ref$transformNode===void 0?function(node){return node}:_ref$transformNode,_ref$selfClose=_ref.selfClose,selfClose=_ref$selfClose===void 0?!0:_ref$selfClose;if(Array.isArray(_ast))return _ast.map(function(ast2){return stringify9(ast2,{transformAttr,selfClose,transformNode})}).join("");var ast=transformNode(_ast);if(ast.type==="text")return escapeText2(ast.value);var attributes2="";for(var attr in ast.attributes){var attrStr=transformAttr(attr,ast.attributes[attr],escapeAttr,ast.name);attributes2+=attrStr?" ".concat(attrStr):""}return ast.children&&ast.children.length>0||!selfClose?"<".concat(ast.name).concat(attributes2,">").concat(stringify9(ast.children,{transformAttr,transformNode,selfClose}),"</").concat(ast.name,">"):"<".concat(ast.name).concat(attributes2,"/>")},indexUmd=Object.assign({},{parse:svgson,parseSync:svgsonSync,stringify:stringify8});return indexUmd}))}});var require_react_jsx_runtime_development=__commonJS({"node_modules/react/cjs/react-jsx-runtime.development.js"(exports){"use strict";(function(){function getComponentNameFromType(type){if(type==null)return null;if(typeof type=="function")return type.$$typeof===REACT_CLIENT_REFERENCE?null:type.displayName||type.name||null;if(typeof type=="string")return type;switch(type){case REACT_FRAGMENT_TYPE:return"Fragment";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";case REACT_ACTIVITY_TYPE:return"Activity"}if(typeof type=="object")switch(typeof type.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),type.$$typeof){case REACT_PORTAL_TYPE:return"Portal";case REACT_CONTEXT_TYPE:return type.displayName||"Context";case REACT_CONSUMER_TYPE:return(type._context.displayName||"Context")+".Consumer";case REACT_FORWARD_REF_TYPE:var innerType=type.render;return type=type.displayName,type||(type=innerType.displayName||innerType.name||"",type=type!==""?"ForwardRef("+type+")":"ForwardRef"),type;case REACT_MEMO_TYPE:return innerType=type.displayName||null,innerType!==null?innerType:getComponentNameFromType(type.type)||"Memo";case REACT_LAZY_TYPE:innerType=type._payload,type=type._init;try{return getComponentNameFromType(type(innerType))}catch{}}return null}function testStringCoercion(value){return""+value}function checkKeyStringCoercion(value){try{testStringCoercion(value);var JSCompiler_inline_result=!1}catch{JSCompiler_inline_result=!0}if(JSCompiler_inline_result){JSCompiler_inline_result=console;var JSCompiler_temp_const=JSCompiler_inline_result.error,JSCompiler_inline_result$jscomp$0=typeof Symbol=="function"&&Symbol.toStringTag&&value[Symbol.toStringTag]||value.constructor.name||"Object";return JSCompiler_temp_const.call(JSCompiler_inline_result,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",JSCompiler_inline_result$jscomp$0),testStringCoercion(value)}}function getTaskName(type){if(type===REACT_FRAGMENT_TYPE)return"<>";if(typeof type=="object"&&type!==null&&type.$$typeof===REACT_LAZY_TYPE)return"<...>";try{var name=getComponentNameFromType(type);return name?"<"+name+">":"<...>"}catch{return"<...>"}}function getOwner(){var dispatcher=ReactSharedInternals.A;return dispatcher===null?null:dispatcher.getOwner()}function UnknownOwner(){return Error("react-stack-top-frame")}function hasValidKey(config){if(hasOwnProperty.call(config,"key")){var getter=Object.getOwnPropertyDescriptor(config,"key").get;if(getter&&getter.isReactWarning)return!1}return config.key!==void 0}function defineKeyPropWarningGetter(props,displayName){function warnAboutAccessingKey(){specialPropKeyWarningShown||(specialPropKeyWarningShown=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",displayName))}warnAboutAccessingKey.isReactWarning=!0,Object.defineProperty(props,"key",{get:warnAboutAccessingKey,configurable:!0})}function elementRefGetterWithDeprecationWarning(){var componentName=getComponentNameFromType(this.type);return didWarnAboutElementRef[componentName]||(didWarnAboutElementRef[componentName]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),componentName=this.props.ref,componentName!==void 0?componentName:null}function ReactElement(type,key,props,owner,debugStack,debugTask){var refProp=props.ref;return type={$$typeof:REACT_ELEMENT_TYPE,type,key,props,_owner:owner},(refProp!==void 0?refProp:null)!==null?Object.defineProperty(type,"ref",{enumerable:!1,get:elementRefGetterWithDeprecationWarning}):Object.defineProperty(type,"ref",{enumerable:!1,value:null}),type._store={},Object.defineProperty(type._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(type,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(type,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:debugStack}),Object.defineProperty(type,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:debugTask}),Object.freeze&&(Object.freeze(type.props),Object.freeze(type)),type}function jsxDEVImpl(type,config,maybeKey,isStaticChildren,debugStack,debugTask){var children=config.children;if(children!==void 0)if(isStaticChildren)if(isArrayImpl(children)){for(isStaticChildren=0;isStaticChildren<children.length;isStaticChildren++)validateChildKeys(children[isStaticChildren]);Object.freeze&&Object.freeze(children)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else validateChildKeys(children);if(hasOwnProperty.call(config,"key")){children=getComponentNameFromType(type);var keys=Object.keys(config).filter(function(k4){return k4!=="key"});isStaticChildren=0<keys.length?"{key: someKey, "+keys.join(": ..., ")+": ...}":"{key: someKey}",didWarnAboutKeySpread[children+isStaticChildren]||(keys=0<keys.length?"{"+keys.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
216
216
|
let props = %s;
|
|
217
217
|
<%s {...props} />
|
|
218
218
|
React keys must be passed directly to JSX without using spread:
|
|
219
219
|
let props = %s;
|
|
220
|
-
<%s key={someKey} {...props} />`,isStaticChildren,children,keys,children),didWarnAboutKeySpread[children+isStaticChildren]=!0)}if(children=null,maybeKey!==void 0&&(checkKeyStringCoercion(maybeKey),children=""+maybeKey),hasValidKey(config)&&(checkKeyStringCoercion(config.key),children=""+config.key),"key"in config){maybeKey={};for(var propName in config)propName!=="key"&&(maybeKey[propName]=config[propName])}else maybeKey=config;return children&&defineKeyPropWarningGetter(maybeKey,typeof type=="function"?type.displayName||type.name||"Unknown":type),ReactElement(type,children,maybeKey,getOwner(),debugStack,debugTask)}function validateChildKeys(node){isValidElement3(node)?node._store&&(node._store.validated=1):typeof node=="object"&&node!==null&&node.$$typeof===REACT_LAZY_TYPE&&(node._payload.status==="fulfilled"?isValidElement3(node._payload.value)&&node._payload.value._store&&(node._payload.value._store.validated=1):node._store&&(node._store.validated=1))}function isValidElement3(object){return typeof object=="object"&&object!==null&&object.$$typeof===REACT_ELEMENT_TYPE}var React5=require_react(),REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_PORTAL_TYPE=Symbol.for("react.portal"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment"),REACT_STRICT_MODE_TYPE=Symbol.for("react.strict_mode"),REACT_PROFILER_TYPE=Symbol.for("react.profiler"),REACT_CONSUMER_TYPE=Symbol.for("react.consumer"),REACT_CONTEXT_TYPE=Symbol.for("react.context"),REACT_FORWARD_REF_TYPE=Symbol.for("react.forward_ref"),REACT_SUSPENSE_TYPE=Symbol.for("react.suspense"),REACT_SUSPENSE_LIST_TYPE=Symbol.for("react.suspense_list"),REACT_MEMO_TYPE=Symbol.for("react.memo"),REACT_LAZY_TYPE=Symbol.for("react.lazy"),REACT_ACTIVITY_TYPE=Symbol.for("react.activity"),REACT_CLIENT_REFERENCE=Symbol.for("react.client.reference"),ReactSharedInternals=React5.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,hasOwnProperty=Object.prototype.hasOwnProperty,isArrayImpl=Array.isArray,createTask=console.createTask?console.createTask:function(){return null};React5={react_stack_bottom_frame:function(callStackForError){return callStackForError()}};var specialPropKeyWarningShown,didWarnAboutElementRef={},unknownOwnerDebugStack=React5.react_stack_bottom_frame.bind(React5,UnknownOwner)(),unknownOwnerDebugTask=createTask(getTaskName(UnknownOwner)),didWarnAboutKeySpread={};exports.Fragment=REACT_FRAGMENT_TYPE,exports.jsx=function(type,config,maybeKey){var trackActualOwner=1e4>ReactSharedInternals.recentlyCreatedOwnerStacks++;return jsxDEVImpl(type,config,maybeKey,!1,trackActualOwner?Error("react-stack-top-frame"):unknownOwnerDebugStack,trackActualOwner?createTask(getTaskName(type)):unknownOwnerDebugTask)},exports.jsxs=function(type,config,maybeKey){var trackActualOwner=1e4>ReactSharedInternals.recentlyCreatedOwnerStacks++;return jsxDEVImpl(type,config,maybeKey,!0,trackActualOwner?Error("react-stack-top-frame"):unknownOwnerDebugStack,trackActualOwner?createTask(getTaskName(type)):unknownOwnerDebugTask)}})()}});var require_jsx_runtime=__commonJS({"node_modules/react/jsx-runtime.js"(exports,module){"use strict";module.exports=require_react_jsx_runtime_development()}});function applyToPoint3(matrix2,point7){return Array.isArray(point7)?[matrix2.a*point7[0]+matrix2.c*point7[1]+matrix2.e,matrix2.b*point7[0]+matrix2.d*point7[1]+matrix2.f]:{x:matrix2.a*point7.x+matrix2.c*point7.y+matrix2.e,y:matrix2.b*point7.x+matrix2.d*point7.y+matrix2.f}}var init_applyToPoint2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/applyToPoint.js"(){"use strict"}});var init_fromObject2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromObject.js"(){"use strict"}});var init_fromString2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromString.js"(){"use strict"}});var init_identity2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/identity.js"(){"use strict"}});function inverse3(matrix2){let{a:a3,b:b3,c:c4,d:d4,e:e5,f:f3}=matrix2,denom=a3*d4-b3*c4;return{a:d4/denom,b:b3/-denom,c:c4/-denom,d:a3/denom,e:(d4*e5-c4*f3)/-denom,f:(b3*e5-a3*f3)/denom}}var init_inverse2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/inverse.js"(){"use strict"}});function isUndefined3(val){return typeof val>"u"}var init_utils2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/utils.js"(){"use strict"}});var init_isAffineMatrix2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/isAffineMatrix.js"(){"use strict";init_utils2()}});function translate3(tx3,ty3=0){return{a:1,c:0,e:tx3,b:0,d:1,f:ty3}}var init_translate2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/translate.js"(){"use strict"}});function transform3(...matrices){matrices=Array.isArray(matrices[0])?matrices[0]:matrices;let multiply=(m12,m22)=>({a:m12.a*m22.a+m12.c*m22.b,c:m12.a*m22.c+m12.c*m22.d,e:m12.a*m22.e+m12.c*m22.f+m12.e,b:m12.b*m22.a+m12.d*m22.b,d:m12.b*m22.c+m12.d*m22.d,f:m12.b*m22.e+m12.d*m22.f+m12.f});switch(matrices.length){case 0:throw new Error("no matrices provided");case 1:return matrices[0];case 2:return multiply(matrices[0],matrices[1]);default:{let[m12,m22,...rest]=matrices,m4=multiply(m12,m22);return transform3(m4,...rest)}}}function compose3(...matrices){return transform3(...matrices)}var init_transform2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/transform.js"(){"use strict"}});function rotate3(angle,cx3,cy3){let cosAngle=cos4(angle),sinAngle=sin4(angle),rotationMatrix={a:cosAngle,c:-sinAngle,e:0,b:sinAngle,d:cosAngle,f:0};return isUndefined3(cx3)||isUndefined3(cy3)?rotationMatrix:transform3([translate3(cx3,cy3),rotationMatrix,translate3(-cx3,-cy3)])}var cos4,sin4,PI5,init_rotate2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/rotate.js"(){"use strict";init_utils2();init_translate2();init_transform2();({cos:cos4,sin:sin4,PI:PI5}=Math)}});function scale3(sx3,sy3=void 0,cx3=void 0,cy3=void 0){isUndefined3(sy3)&&(sy3=sx3);let scaleMatrix={a:sx3,c:0,e:0,b:0,d:sy3,f:0};return isUndefined3(cx3)||isUndefined3(cy3)?scaleMatrix:transform3([translate3(cx3,cy3),scaleMatrix,translate3(-cx3,-cy3)])}var init_scale2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/scale.js"(){"use strict";init_utils2();init_translate2();init_transform2()}});var init_shear2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/shear.js"(){"use strict"}});var tan4,init_skew2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/skew.js"(){"use strict";({tan:tan4}=Math)}});function toSVG(matrix2){return toString(matrix2)}function toString(matrix2){return`matrix(${matrix2.a},${matrix2.b},${matrix2.c},${matrix2.d},${matrix2.e},${matrix2.f})`}var init_toString2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/toString.js"(){"use strict"}});function smoothMatrix3(matrix2,precision=1e10){return{a:Math.round(matrix2.a*precision)/precision,b:Math.round(matrix2.b*precision)/precision,c:Math.round(matrix2.c*precision)/precision,d:Math.round(matrix2.d*precision)/precision,e:Math.round(matrix2.e*precision)/precision,f:Math.round(matrix2.f*precision)/precision}}var init_smoothMatrix2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/smoothMatrix.js"(){"use strict"}});function fromTriangles(t110,t210){let px1=t110[0].x!=null?t110[0].x:t110[0][0],py1=t110[0].y!=null?t110[0].y:t110[0][1],px22=t210[0].x!=null?t210[0].x:t210[0][0],py22=t210[0].y!=null?t210[0].y:t210[0][1],qx1=t110[1].x!=null?t110[1].x:t110[1][0],qy1=t110[1].y!=null?t110[1].y:t110[1][1],qx22=t210[1].x!=null?t210[1].x:t210[1][0],qy22=t210[1].y!=null?t210[1].y:t210[1][1],rx1=t110[2].x!=null?t110[2].x:t110[2][0],ry1=t110[2].y!=null?t110[2].y:t110[2][1],rx22=t210[2].x!=null?t210[2].x:t210[2][0],ry22=t210[2].y!=null?t210[2].y:t210[2][1],r12={a:px1-rx1,b:py1-ry1,c:qx1-rx1,d:qy1-ry1,e:rx1,f:ry1},r22={a:px22-rx22,b:py22-ry22,c:qx22-rx22,d:qy22-ry22,e:rx22,f:ry22},inverseR1=inverse3(r12),affineMatrix=transform3([r22,inverseR1]);return smoothMatrix3(affineMatrix)}var init_fromTriangles2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromTriangles.js"(){"use strict";init_inverse2();init_transform2();init_smoothMatrix2()}});var init_fromDefinition2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromDefinition.js"(){"use strict";init_fromObject2();init_translate2();init_scale2();init_rotate2();init_skew2();init_shear2()}});function peg$subclass2(child,parent){function C4(){this.constructor=child}C4.prototype=parent.prototype,child.prototype=new C4}function peg$SyntaxError2(message,expected,found,location){var self2=Error.call(this,message);return Object.setPrototypeOf&&Object.setPrototypeOf(self2,peg$SyntaxError2.prototype),self2.expected=expected,self2.found=found,self2.location=location,self2.name="SyntaxError",self2}function peg$padEnd2(str,targetLength,padString){return padString=padString||" ",str.length>targetLength?str:(targetLength-=str.length,padString+=padString.repeat(targetLength),str+padString.slice(0,targetLength))}var init_fromTransformAttribute_autogenerated2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromTransformAttribute.autogenerated.js"(){"use strict";peg$subclass2(peg$SyntaxError2,Error);peg$SyntaxError2.prototype.format=function(sources){var str="Error: "+this.message;if(this.location){var src=null,k4;for(k4=0;k4<sources.length;k4++)if(sources[k4].source===this.location.source){src=sources[k4].text.split(/\r\n|\n|\r/g);break}var s3=this.location.start,offset_s=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(s3):s3,loc=this.location.source+":"+offset_s.line+":"+offset_s.column;if(src){var e5=this.location.end,filler=peg$padEnd2("",offset_s.line.toString().length," "),line2=src[s3.line-1],last=s3.line===e5.line?e5.column:line2.length+1,hatLen=last-s3.column||1;str+=`
|
|
220
|
+
<%s key={someKey} {...props} />`,isStaticChildren,children,keys,children),didWarnAboutKeySpread[children+isStaticChildren]=!0)}if(children=null,maybeKey!==void 0&&(checkKeyStringCoercion(maybeKey),children=""+maybeKey),hasValidKey(config)&&(checkKeyStringCoercion(config.key),children=""+config.key),"key"in config){maybeKey={};for(var propName in config)propName!=="key"&&(maybeKey[propName]=config[propName])}else maybeKey=config;return children&&defineKeyPropWarningGetter(maybeKey,typeof type=="function"?type.displayName||type.name||"Unknown":type),ReactElement(type,children,maybeKey,getOwner(),debugStack,debugTask)}function validateChildKeys(node){isValidElement3(node)?node._store&&(node._store.validated=1):typeof node=="object"&&node!==null&&node.$$typeof===REACT_LAZY_TYPE&&(node._payload.status==="fulfilled"?isValidElement3(node._payload.value)&&node._payload.value._store&&(node._payload.value._store.validated=1):node._store&&(node._store.validated=1))}function isValidElement3(object){return typeof object=="object"&&object!==null&&object.$$typeof===REACT_ELEMENT_TYPE}var React5=require_react(),REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_PORTAL_TYPE=Symbol.for("react.portal"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment"),REACT_STRICT_MODE_TYPE=Symbol.for("react.strict_mode"),REACT_PROFILER_TYPE=Symbol.for("react.profiler"),REACT_CONSUMER_TYPE=Symbol.for("react.consumer"),REACT_CONTEXT_TYPE=Symbol.for("react.context"),REACT_FORWARD_REF_TYPE=Symbol.for("react.forward_ref"),REACT_SUSPENSE_TYPE=Symbol.for("react.suspense"),REACT_SUSPENSE_LIST_TYPE=Symbol.for("react.suspense_list"),REACT_MEMO_TYPE=Symbol.for("react.memo"),REACT_LAZY_TYPE=Symbol.for("react.lazy"),REACT_ACTIVITY_TYPE=Symbol.for("react.activity"),REACT_CLIENT_REFERENCE=Symbol.for("react.client.reference"),ReactSharedInternals=React5.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,hasOwnProperty=Object.prototype.hasOwnProperty,isArrayImpl=Array.isArray,createTask=console.createTask?console.createTask:function(){return null};React5={react_stack_bottom_frame:function(callStackForError){return callStackForError()}};var specialPropKeyWarningShown,didWarnAboutElementRef={},unknownOwnerDebugStack=React5.react_stack_bottom_frame.bind(React5,UnknownOwner)(),unknownOwnerDebugTask=createTask(getTaskName(UnknownOwner)),didWarnAboutKeySpread={};exports.Fragment=REACT_FRAGMENT_TYPE,exports.jsx=function(type,config,maybeKey){var trackActualOwner=1e4>ReactSharedInternals.recentlyCreatedOwnerStacks++;return jsxDEVImpl(type,config,maybeKey,!1,trackActualOwner?Error("react-stack-top-frame"):unknownOwnerDebugStack,trackActualOwner?createTask(getTaskName(type)):unknownOwnerDebugTask)},exports.jsxs=function(type,config,maybeKey){var trackActualOwner=1e4>ReactSharedInternals.recentlyCreatedOwnerStacks++;return jsxDEVImpl(type,config,maybeKey,!0,trackActualOwner?Error("react-stack-top-frame"):unknownOwnerDebugStack,trackActualOwner?createTask(getTaskName(type)):unknownOwnerDebugTask)}})()}});var require_jsx_runtime=__commonJS({"node_modules/react/jsx-runtime.js"(exports,module){"use strict";module.exports=require_react_jsx_runtime_development()}});function applyToPoint3(matrix2,point7){return Array.isArray(point7)?[matrix2.a*point7[0]+matrix2.c*point7[1]+matrix2.e,matrix2.b*point7[0]+matrix2.d*point7[1]+matrix2.f]:{x:matrix2.a*point7.x+matrix2.c*point7.y+matrix2.e,y:matrix2.b*point7.x+matrix2.d*point7.y+matrix2.f}}var init_applyToPoint2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/applyToPoint.js"(){"use strict"}});var init_fromObject2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromObject.js"(){"use strict"}});var init_fromString2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromString.js"(){"use strict"}});var init_identity2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/identity.js"(){"use strict"}});function inverse3(matrix2){let{a:a3,b:b3,c:c4,d:d4,e:e5,f:f3}=matrix2,denom=a3*d4-b3*c4;return{a:d4/denom,b:b3/-denom,c:c4/-denom,d:a3/denom,e:(d4*e5-c4*f3)/-denom,f:(b3*e5-a3*f3)/denom}}var init_inverse2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/inverse.js"(){"use strict"}});function isUndefined3(val){return typeof val>"u"}var init_utils2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/utils.js"(){"use strict"}});var init_isAffineMatrix2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/isAffineMatrix.js"(){"use strict";init_utils2()}});function translate3(tx3,ty3=0){return{a:1,c:0,e:tx3,b:0,d:1,f:ty3}}var init_translate2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/translate.js"(){"use strict"}});function transform3(...matrices){matrices=Array.isArray(matrices[0])?matrices[0]:matrices;let multiply=(m12,m22)=>({a:m12.a*m22.a+m12.c*m22.b,c:m12.a*m22.c+m12.c*m22.d,e:m12.a*m22.e+m12.c*m22.f+m12.e,b:m12.b*m22.a+m12.d*m22.b,d:m12.b*m22.c+m12.d*m22.d,f:m12.b*m22.e+m12.d*m22.f+m12.f});switch(matrices.length){case 0:throw new Error("no matrices provided");case 1:return matrices[0];case 2:return multiply(matrices[0],matrices[1]);default:{let[m12,m22,...rest]=matrices,m4=multiply(m12,m22);return transform3(m4,...rest)}}}function compose3(...matrices){return transform3(...matrices)}var init_transform2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/transform.js"(){"use strict"}});function rotate3(angle,cx3,cy3){let cosAngle=cos4(angle),sinAngle=sin4(angle),rotationMatrix={a:cosAngle,c:-sinAngle,e:0,b:sinAngle,d:cosAngle,f:0};return isUndefined3(cx3)||isUndefined3(cy3)?rotationMatrix:transform3([translate3(cx3,cy3),rotationMatrix,translate3(-cx3,-cy3)])}var cos4,sin4,PI5,init_rotate2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/rotate.js"(){"use strict";init_utils2();init_translate2();init_transform2();({cos:cos4,sin:sin4,PI:PI5}=Math)}});function scale3(sx3,sy3=void 0,cx3=void 0,cy3=void 0){isUndefined3(sy3)&&(sy3=sx3);let scaleMatrix={a:sx3,c:0,e:0,b:0,d:sy3,f:0};return isUndefined3(cx3)||isUndefined3(cy3)?scaleMatrix:transform3([translate3(cx3,cy3),scaleMatrix,translate3(-cx3,-cy3)])}var init_scale2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/scale.js"(){"use strict";init_utils2();init_translate2();init_transform2()}});var init_shear2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/shear.js"(){"use strict"}});var tan4,init_skew2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/skew.js"(){"use strict";({tan:tan4}=Math)}});function toSVG(matrix2){return toString2(matrix2)}function toString2(matrix2){return`matrix(${matrix2.a},${matrix2.b},${matrix2.c},${matrix2.d},${matrix2.e},${matrix2.f})`}var init_toString2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/toString.js"(){"use strict"}});function smoothMatrix3(matrix2,precision=1e10){return{a:Math.round(matrix2.a*precision)/precision,b:Math.round(matrix2.b*precision)/precision,c:Math.round(matrix2.c*precision)/precision,d:Math.round(matrix2.d*precision)/precision,e:Math.round(matrix2.e*precision)/precision,f:Math.round(matrix2.f*precision)/precision}}var init_smoothMatrix2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/smoothMatrix.js"(){"use strict"}});function fromTriangles(t110,t210){let px1=t110[0].x!=null?t110[0].x:t110[0][0],py1=t110[0].y!=null?t110[0].y:t110[0][1],px22=t210[0].x!=null?t210[0].x:t210[0][0],py22=t210[0].y!=null?t210[0].y:t210[0][1],qx1=t110[1].x!=null?t110[1].x:t110[1][0],qy1=t110[1].y!=null?t110[1].y:t110[1][1],qx22=t210[1].x!=null?t210[1].x:t210[1][0],qy22=t210[1].y!=null?t210[1].y:t210[1][1],rx1=t110[2].x!=null?t110[2].x:t110[2][0],ry1=t110[2].y!=null?t110[2].y:t110[2][1],rx22=t210[2].x!=null?t210[2].x:t210[2][0],ry22=t210[2].y!=null?t210[2].y:t210[2][1],r12={a:px1-rx1,b:py1-ry1,c:qx1-rx1,d:qy1-ry1,e:rx1,f:ry1},r22={a:px22-rx22,b:py22-ry22,c:qx22-rx22,d:qy22-ry22,e:rx22,f:ry22},inverseR1=inverse3(r12),affineMatrix=transform3([r22,inverseR1]);return smoothMatrix3(affineMatrix)}var init_fromTriangles2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromTriangles.js"(){"use strict";init_inverse2();init_transform2();init_smoothMatrix2()}});var init_fromDefinition2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromDefinition.js"(){"use strict";init_fromObject2();init_translate2();init_scale2();init_rotate2();init_skew2();init_shear2()}});function peg$subclass2(child,parent){function C4(){this.constructor=child}C4.prototype=parent.prototype,child.prototype=new C4}function peg$SyntaxError2(message,expected,found,location){var self2=Error.call(this,message);return Object.setPrototypeOf&&Object.setPrototypeOf(self2,peg$SyntaxError2.prototype),self2.expected=expected,self2.found=found,self2.location=location,self2.name="SyntaxError",self2}function peg$padEnd2(str,targetLength,padString){return padString=padString||" ",str.length>targetLength?str:(targetLength-=str.length,padString+=padString.repeat(targetLength),str+padString.slice(0,targetLength))}var init_fromTransformAttribute_autogenerated2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromTransformAttribute.autogenerated.js"(){"use strict";peg$subclass2(peg$SyntaxError2,Error);peg$SyntaxError2.prototype.format=function(sources){var str="Error: "+this.message;if(this.location){var src=null,k4;for(k4=0;k4<sources.length;k4++)if(sources[k4].source===this.location.source){src=sources[k4].text.split(/\r\n|\n|\r/g);break}var s3=this.location.start,offset_s=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(s3):s3,loc=this.location.source+":"+offset_s.line+":"+offset_s.column;if(src){var e5=this.location.end,filler=peg$padEnd2("",offset_s.line.toString().length," "),line2=src[s3.line-1],last=s3.line===e5.line?e5.column:line2.length+1,hatLen=last-s3.column||1;str+=`
|
|
221
221
|
--> `+loc+`
|
|
222
222
|
`+filler+` |
|
|
223
223
|
`+offset_s.line+" | "+line2+`
|
|
224
224
|
`+filler+" | "+peg$padEnd2("",s3.column-1," ")+peg$padEnd2("",hatLen,"^")}else str+=`
|
|
225
|
-
at `+loc}return str};peg$SyntaxError2.buildMessage=function(expected,found){var DESCRIBE_EXPECTATION_FNS={literal:function(expectation){return'"'+literalEscape(expectation.text)+'"'},class:function(expectation){var escapedParts=expectation.parts.map(function(part){return Array.isArray(part)?classEscape(part[0])+"-"+classEscape(part[1]):classEscape(part)});return"["+(expectation.inverted?"^":"")+escapedParts.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(expectation){return expectation.description}};function hex(ch3){return ch3.charCodeAt(0).toString(16).toUpperCase()}function literalEscape(s3){return s3.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch3){return"\\x0"+hex(ch3)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch3){return"\\x"+hex(ch3)})}function classEscape(s3){return s3.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch3){return"\\x0"+hex(ch3)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch3){return"\\x"+hex(ch3)})}function describeExpectation(expectation){return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation)}function describeExpected(expected2){var descriptions=expected2.map(describeExpectation),i3,j4;if(descriptions.sort(),descriptions.length>0){for(i3=1,j4=1;i3<descriptions.length;i3++)descriptions[i3-1]!==descriptions[i3]&&(descriptions[j4]=descriptions[i3],j4++);descriptions.length=j4}switch(descriptions.length){case 1:return descriptions[0];case 2:return descriptions[0]+" or "+descriptions[1];default:return descriptions.slice(0,-1).join(", ")+", or "+descriptions[descriptions.length-1]}}function describeFound(found2){return found2?'"'+literalEscape(found2)+'"':"end of input"}return"Expected "+describeExpected(expected)+" but "+describeFound(found)+" found."}}});var init_fromTransformAttribute2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromTransformAttribute.js"(){"use strict";init_fromTransformAttribute_autogenerated2()}});var init_decompose2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/decompose.js"(){"use strict";init_scale2();init_transform2()}});var init_flip2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/flip.js"(){"use strict"}});var init_fromMovingPoints2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromMovingPoints.js"(){"use strict";init_translate2();init_applyToPoint2();init_rotate2();init_scale2();init_transform2()}});var init_src2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/index.js"(){"use strict";init_applyToPoint2();init_fromObject2();init_fromString2();init_identity2();init_inverse2();init_isAffineMatrix2();init_rotate2();init_scale2();init_shear2();init_skew2();init_toString2();init_transform2();init_translate2();init_fromTriangles2();init_smoothMatrix2();init_fromDefinition2();init_fromTransformAttribute2();init_decompose2();init_flip2();init_fromMovingPoints2()}});var svgAlphabet,lineAlphabet,init_dist7=__esm({"node_modules/@tscircuit/alphabet/dist/index.js"(){"use strict";svgAlphabet={0:"M0.301025 0.257813 L0.206593 0.283385 L0.122042 0.361307 L0.075923 0.474441 L0.064942 0.642221 L0.091296 0.78289 L0.159376 0.899463 L0.257104 0.961214 L0.344948 0.961214 L0.442678 0.899463 L0.510757 0.78289 L0.537111 0.642221 L0.526131 0.474441 L0.480012 0.361307 L0.39546 0.283385 L0.301025 0.257813",1:"M0.220426 0.40845 L0.381626 0.270996 L0.381626 0.948966",2:"M0.110409 0.39212 L0.125621 0.342293 L0.170571 0.295823 L0.244237 0.26431 L0.291518 0.257813 L0.373319 0.263799 L0.434683 0.290705 L0.468239 0.331966 L0.480292 0.379913 L0.479492 0.411806 L0.465088 0.465192 L0.402571 0.568988 L0.245134 0.766438 L0.07959 0.948045 L0.522462 0.948045",3:"M0.081606 0.345073 L0.119154 0.315633 L0.178996 0.284091 L0.255265 0.257813 L0.349133 0.263062 L0.43127 0.289348 L0.48994 0.336662 L0.525141 0.394491 L0.513407 0.457577 L0.466472 0.504892 L0.384334 0.541692 L0.290464 0.56272 L0.20833 0.573235 L0.290464 0.583749 L0.384334 0.610035 L0.466472 0.652092 L0.519274 0.709922 L0.531007 0.773007 L0.50754 0.841351 L0.454738 0.899179 L0.3726 0.946494 L0.310412 0.961214 L0.209503 0.959111 L0.127367 0.946494 L0.071046 0.929671",4:"M0.418494 0.270996 L0.048828 0.724199 L0.553224 0.724199 M0.414181 0.578167 L0.414181 0.94897",5:"M0.074951 0.270996 L0.074951 0.614701 L0.267655 0.5695 L0.405247 0.586502 L0.460002 0.617189 L0.498028 0.660731 L0.527101 0.779401 L0.513352 0.841049 L0.477274 0.889568 L0.406378 0.93463 L0.324445 0.958337 L0.247399 0.962139 L0.182516 0.949767 L0.130068 0.925508 L0.074951 0.875607 M0.074951 0.270996 L0.527101 0.270996",6:"M0.428549 0.257813 L0.341433 0.285053 L0.26073 0.312099 L0.192188 0.360182 L0.138902 0.410969 L0.098219 0.500422 L0.070249 0.584267 L0.067264 0.670716 L0.065164 0.756863 L0.087163 0.820973 L0.108168 0.861042 L0.157916 0.913131 L0.210981 0.948192 L0.29279 0.961214 L0.384548 0.956206 L0.456409 0.924151 L0.507262 0.881077 L0.5349 0.821975 L0.537111 0.771889 L0.521634 0.718798 L0.498418 0.67372 L0.463042 0.636657 L0.414398 0.613617 L0.34696 0.598591 L0.28284 0.595587 L0.215403 0.605604 L0.145756 0.641665 L0.109274 0.678729 L0.064942 0.724006",7:"M0.071534 0.270996 L0.530519 0.270996 L0.495935 0.291702 L0.477752 0.305407 L0.435186 0.346112 L0.412067 0.374136 L0.388565 0.40796 L0.365315 0.448098 L0.342943 0.495062 L0.322081 0.549366 L0.303364 0.611524 L0.287416 0.68205 L0.270077 0.80465 L0.26253 0.94897",8:"M0.286761 0.257813 L0.210684 0.27162 L0.1414 0.305622 L0.092494 0.382125 L0.111513 0.450128 L0.16857 0.502193 L0.228345 0.539382 L0.377781 0.594635 L0.470161 0.645637 L0.52586 0.706203 L0.538087 0.792269 L0.506841 0.87621 L0.438915 0.927212 L0.339743 0.961214 L0.263666 0.959089 L0.174004 0.929337 L0.102003 0.881523 L0.063965 0.811395 L0.066682 0.741266 L0.102003 0.671139 L0.180797 0.608448 L0.259591 0.580822 L0.358762 0.548945 L0.456576 0.49688 L0.486463 0.446941 L0.487822 0.362999 L0.453859 0.302434 L0.384574 0.265245 L0.286761 0.257813",9:"M0.511026 0.437812 L0.491026 0.347812 L0.451026 0.297812 L0.391026 0.267812 L0.311026 0.257813 L0.231026 0.267812 L0.161026 0.297812 L0.111026 0.347812 L0.091026 0.417812 L0.111026 0.487812 L0.161026 0.537812 L0.231026 0.567812 L0.311026 0.577812 L0.391026 0.557812 L0.451026 0.517812 L0.491026 0.477812 L0.511026 0.437812 M0.510026 0.438812 L0.434026 0.636812 L0.381026 0.777812 L0.337026 0.879812 L0.301026 0.957812","!":"M0.301026 0.270996 L0.301026 0.749566 M0.251466 0.94897 L0.350587 0.94897",'"':"M0.16504 0.270996 L0.16504 0.523022 M0.437013 0.270996 L0.437013 0.523022","#":"M0.20958 0.282227 L0.146515 0.949754 M0.461844 0.282227 L0.398779 0.949754 M0.032999 0.526969 L0.600587 0.452796 M0.001465 0.82366 L0.569055 0.749486",$:"M0.307121 0.240234 L0.307121 1.083502 M0.490031 0.415915 L0.404676 0.328075 L0.23396 0.310507 L0.136407 0.398347 L0.099828 0.521324 L0.124213 0.591596 L0.197379 0.644299 L0.429061 0.697003 L0.502224 0.749708 L0.526613 0.837547 L0.477836 0.960526 L0.355897 1.013228 L0.197379 0.99566 L0.112021 0.942957 L0.07544 0.837547","'":"M0.301026 0.270996 L0.301026 0.523022","(":"M0.413087 0.241211 L0.372337 0.28347 L0.331589 0.334184 L0.290838 0.393349 L0.25009 0.460965 L0.219528 0.528584 L0.199153 0.5962 L0.188966 0.655364 L0.199153 0.714529 L0.219528 0.782146 L0.25009 0.849764 L0.290838 0.91738 L0.331589 0.976544 L0.372337 1.027258 L0.413087 1.069491",")":"M0.188966 0.241211 L0.229716 0.28347 L0.270466 0.334184 L0.311213 0.393349 L0.351964 0.460965 L0.382526 0.528584 L0.4029 0.5962 L0.413087 0.655364 L0.4029 0.714529 L0.382526 0.782146 L0.351964 0.849764 L0.311213 0.91738 L0.270466 0.976544 L0.229716 1.027258 L0.188966 1.069491","*":"M0.301026 0.458702 L0.301026 0.681942 M0.301026 0.458702 L0.520997 0.536834 M0.301026 0.458702 L0.439954 0.257813 M0.301026 0.458702 L0.162098 0.257813 M0.301026 0.458702 L0.081055 0.536834","+":"M0.042969 0.66845 L0.559083 0.66845 M0.301023 0.428223 L0.301023 0.908661",",":"M0.38672 0.852051 L0.215333 1.030661 L0.301025 1.119971","-":"M0.173829 0.686035 L0.428224 0.686035",".":"M0.362549 0.851074 L0.239503 0.851074","/":"M0.062501 1.035249 L0.539551 0.270996","<":"M0.559083 0.441895 L0.042969 0.66939 L0.042969 0.66939 L0.559083 0.896902","=":"M0.042969 0.545898 L0.559083 0.545898 M0.042969 0.80837 L0.559083 0.80837",">":"M0.042969 0.441895 L0.559083 0.66939 L0.559083 0.66939 L0.042969 0.896902",A:"M0.018067 0.94897 L0.290179 0.270996 L0.583986 0.94897 M0.155303 0.684521 L0.433548 0.684521",B:"M0.063965 0.94897 L0.063965 0.278953 L0.209356 0.270996 L0.342486 0.294394 L0.432179 0.37292 L0.418224 0.48773 L0.312686 0.549166 L0.084728 0.575531 L0.306377 0.589434 L0.468877 0.647456 L0.538087 0.736658 L0.5324 0.85202 L0.501247 0.902983 L0.42355 0.944398 L0.063965 0.94897",C:"M0.529054 0.419847 L0.498425 0.345196 L0.442238 0.292341 L0.33583 0.257813 L0.257199 0.268357 L0.187906 0.303748 L0.120243 0.385432 L0.072998 0.599844 L0.110073 0.815385 L0.165381 0.902183 L0.222883 0.942801 L0.334904 0.961214 L0.43253 0.937679 L0.504816 0.868999 L0.529054 0.772065",D:"M0.064454 0.94897 L0.071838 0.285078 L0.171217 0.270996 L0.247348 0.272633 L0.37101 0.306078 L0.462461 0.378304 L0.514748 0.475555 L0.535591 0.576392 L0.537599 0.652313 L0.528065 0.717381 L0.508562 0.772419 L0.445948 0.855695 L0.362356 0.90871 L0.225203 0.945862 L0.064454 0.94897",E:"M0.080078 0.270996 L0.080078 0.94897 M0.080078 0.270996 L0.521974 0.270996 M0.080078 0.609981 L0.389405 0.609981 M0.080078 0.94897 L0.521974 0.94897",F:"M0.086426 0.270996 L0.086426 0.94897 M0.091304 0.275607 L0.515626 0.275607 M0.091304 0.607677 L0.447344 0.607677",G:"M0.498034 0.284943 L0.374621 0.257813 L0.244219 0.268648 L0.160577 0.311997 L0.094556 0.398116 L0.056397 0.58404 L0.076752 0.785532 L0.120865 0.858197 L0.188947 0.916734 L0.271008 0.953591 L0.357069 0.961214 L0.43715 0.932047 L0.501262 0.858539 L0.545656 0.648611 L0.329595 0.648131",H:"M0.066895 0.270996 L0.066895 0.94897 M0.066895 0.595658 L0.530009 0.595658 M0.535157 0.270996 L0.535157 0.94897",I:"M0.301026 0.270996 L0.301026 0.94897",J:"M0.506839 0.270996 L0.507814 0.782193 L0.498468 0.846168 L0.480733 0.880789 L0.455864 0.90832 L0.426095 0.929408 L0.360746 0.954812 L0.302508 0.962139 L0.223573 0.953638 L0.16538 0.930312 L0.137072 0.907715 L0.116428 0.880312 L0.102822 0.848819 L0.095633 0.813947 L0.094239 0.776413",K:"M0.035401 0.270996 L0.035401 0.94897 M0.502258 0.316194 L0.035401 0.687823 M0.212484 0.582361 L0.566652 0.933903",L:"M0.07544 0.270996 L0.07544 0.94897 L0.526613 0.94897",M:"M0.042481 0.94897 L0.042481 0.270996 L0.301027 0.712492 L0.559571 0.270996 L0.559571 0.94897",N:"M0.067871 0.94897 L0.067871 0.270996 L0.534181 0.94897 L0.525031 0.270996",O:"M0.287293 0.961214 L0.19843 0.933567 L0.1172 0.849451 L0.057129 0.563945 L0.114348 0.350255 L0.18455 0.289392 L0.306101 0.257813 L0.42054 0.29572 L0.487543 0.365003 L0.544923 0.625294 L0.516366 0.789624 L0.465476 0.884596 L0.375084 0.949287 L0.287293 0.961214",P:"M0.070557 0.94897 L0.070557 0.28379 L0.20704 0.270996 L0.329134 0.278993 L0.408525 0.300514 L0.444022 0.317908 L0.500637 0.368929 L0.525796 0.423728 L0.531496 0.50384 L0.508934 0.554205 L0.473724 0.582043 L0.417577 0.604365 L0.336375 0.620372 L0.226014 0.629268 L0.082368 0.630258",Q:"M0.282435 1.050813 L0.195447 1.019646 L0.115933 0.924817 L0.057129 0.602943 L0.113139 0.362034 L0.18186 0.293418 L0.300844 0.257813 L0.412868 0.300553 L0.478457 0.37866 L0.534625 0.672103 L0.506671 0.857367 L0.456855 0.964437 L0.368371 1.037368 L0.282435 1.050813 M0.341225 0.815559 L0.544923 1.070653",R:"M0.034912 0.944112 L0.034912 0.288556 L0.227127 0.270996 L0.362038 0.276867 L0.443423 0.294907 L0.477644 0.309614 L0.505809 0.328757 L0.526616 0.352817 L0.544963 0.418061 L0.543241 0.475921 L0.524463 0.517817 L0.49076 0.546518 L0.444265 0.564799 L0.355195 0.578739 L0.047653 0.589627 M0.303054 0.617306 L0.56714 0.94897",S:"M0.483037 0.364333 L0.407613 0.267477 L0.22883 0.257813 L0.128623 0.327565 L0.087712 0.455539 L0.104656 0.518727 L0.168054 0.573307 L0.41928 0.617318 L0.503796 0.669342 L0.535157 0.759324 L0.493846 0.900055 L0.367668 0.961214 L0.205436 0.956661 L0.116711 0.907038 L0.066895 0.790334",T:"M0.022949 0.270996 L0.579103 0.270996 M0.309284 0.270996 L0.309284 0.94897",U:"M0.072022 0.270996 L0.07308 0.648875 L0.080372 0.75167 L0.099024 0.827813 L0.134786 0.885729 L0.181571 0.924023 L0.251464 0.95168 L0.339655 0.962139 L0.401553 0.951668 L0.45232 0.924086 L0.482701 0.891771 L0.495745 0.870529 L0.515699 0.81637 L0.525014 0.744626 L0.530031 0.272017",V:"M0.027832 0.270996 L0.320083 0.94897 L0.57422 0.270996",W:"M0 0.270996 L0.079799 0.940377 L0.285198 0.472884 L0.505255 0.94897 L0.602052 0.270996",X:"M0.009034 0.270996 L0.586805 0.94897 M0.593019 0.270996 L0.015246 0.94897",Y:"M0.018067 0.270996 L0.293132 0.574135 M0.583986 0.271959 L0.294954 0.57606 L0.305277 0.94897",Z:"M0.053711 0.270996 L0.548341 0.270996 L0.053711 0.94897 L0.548341 0.94897","[":"M0.404542 0.240234 L0.197511 0.240234 L0.197511 1.069424 L0.404542 1.069424","\\":"M0.062501 0.270996 L0.539551 1.035249","]":"M0.19751 0.240234 L0.404542 0.240234 L0.404542 1.069424 L0.19751 1.069424","^":"M0.035156 0.523931 L0.301024 0.270996 L0.566896 0.523931",_:"M0 1.160601 L0.602052 1.160601",a:"M0.527101 0.439941 L0.527101 0.973965 M0.527101 0.553824 L0.451366 0.477535 L0.376759 0.439941 L0.263722 0.439941 L0.187989 0.477535 L0.112255 0.553824 L0.074951 0.66881 L0.074951 0.745099 L0.112255 0.85898 L0.187989 0.93527 L0.263722 0.973965 L0.376759 0.973965 L0.451366 0.93527 L0.527101 0.85898",b:"M0.07666 0.240234 L0.07666 0.959985 M0.07666 0.582737 L0.151822 0.514237 L0.225865 0.480483 L0.338045 0.480483 L0.413211 0.514237 L0.488374 0.582737 L0.525392 0.685983 L0.525392 0.754485 L0.488374 0.856739 L0.413211 0.92524 L0.338045 0.959985 L0.225865 0.959985 L0.151822 0.92524 L0.07666 0.856739",c:"M0.512452 0.553823 L0.441624 0.477535 L0.371854 0.439941 L0.26614 0.439941 L0.195312 0.477535 L0.124486 0.553823 L0.0896 0.668808 L0.0896 0.745099 L0.124486 0.858979 L0.195312 0.93527 L0.26614 0.973965 L0.371854 0.973965 L0.441624 0.93527 L0.512452 0.858979",d:"M0.525392 0.240234 L0.525392 0.959985 M0.525392 0.582737 L0.450232 0.514237 L0.376189 0.480483 L0.264006 0.480483 L0.188844 0.514237 L0.11368 0.582737 L0.076661 0.685983 L0.076661 0.754485 L0.11368 0.856739 L0.188844 0.92524 L0.264006 0.959985 L0.376189 0.959985 L0.450232 0.92524 L0.525392 0.856739",e:"M0.059571 0.668808 L0.542482 0.668808 M0.542482 0.592521 L0.502641 0.516231 L0.461594 0.477535 L0.381914 0.439941 L0.261186 0.439941 L0.180299 0.477535 L0.099412 0.553823 L0.059571 0.668808 L0.059571 0.745099 L0.099412 0.858979 L0.180299 0.93527 L0.261186 0.973965 L0.381914 0.973965 L0.461594 0.93527 L0.542482 0.858979",f:"M0.512941 0.240234 L0.406984 0.240234 L0.301026 0.274346 L0.248047 0.374731 L0.248047 0.946817 M0.089112 0.476088 L0.459965 0.476088",g:"M0.525392 0.439941 L0.525392 0.989395 L0.488373 1.091918 L0.45023 1.126757 L0.376189 1.160601 L0.264004 1.160601 L0.188844 1.126757 L0.113681 1.058075 L0.076661 0.954555 M0.525392 0.542467 L0.45023 0.473786 L0.376189 0.439941 L0.264004 0.439941 L0.188844 0.473786 L0.113681 0.542467 L0.076661 0.645988 L0.076661 0.714669 L0.113681 0.817193 L0.188844 0.885875 L0.264004 0.920713 L0.376189 0.920713 L0.45023 0.885875 L0.525392 0.817193",h:"M0.092041 0.240234 L0.092041 0.946817 M0.092041 0.61058 L0.205937 0.509225 L0.282214 0.476086 L0.396109 0.476086 L0.47187 0.509225 L0.510011 0.61058 L0.510011 0.946817",i:"M0.261026 0.240234 L0.341026 0.240234 M0.300978 0.476089 L0.300978 0.946817",j:"M0.3853 0.240234 L0.447023 0.240234 M0.416159 0.465708 L0.416159 1.011689 L0.383887 1.108586 L0.252832 1.140264 L0.15503 1.108586",k:"M0.065186 0.240234 L0.065186 0.946817 M0.493824 0.476086 L0.065186 0.812323 M0.236758 0.677829 L0.536867 0.946817",l:"M0.301026 0.234863 L0.301026 0.946441",m:"M0.050538 0.439941 L0.050538 0.960796 M0.050538 0.588758 L0.114405 0.476607 L0.157178 0.439941 L0.236864 0.439941 L0.279637 0.476607 L0.32241 0.588758 L0.32241 0.960796 M0.32241 0.588758 L0.386281 0.476607 L0.428467 0.439941 L0.50874 0.439941 L0.551515 0.476607 L0.551515 0.960796",n:"M0.092041 0.439941 L0.092041 0.960796 M0.092041 0.588758 L0.205936 0.476607 L0.282216 0.439941 L0.396113 0.439941 L0.471871 0.476607 L0.510011 0.588758 L0.510011 0.960796",o:"M0.247175 0.439941 L0.175178 0.477535 L0.103186 0.553823 L0.066895 0.668808 L0.066895 0.745099 L0.103186 0.858979 L0.175178 0.93527 L0.247175 0.973965 L0.354874 0.973965 L0.426872 0.93527 L0.498866 0.858979 L0.535157 0.745099 L0.535157 0.668808 L0.498866 0.553823 L0.426872 0.477535 L0.354874 0.439941 L0.247175 0.439941",p:"M0.076904 0.439941 L0.076904 1.154244 M0.076904 0.541563 L0.151986 0.473487 L0.225944 0.439941 L0.338005 0.439941 L0.413087 0.473487 L0.488166 0.541563 L0.525148 0.644169 L0.525148 0.712246 L0.488166 0.813866 L0.413087 0.881942 L0.338005 0.916471 L0.225944 0.916471 L0.151986 0.881942 L0.076904 0.813866",q:"M0.525148 0.441895 L0.525148 1.156195 M0.525148 0.5435 L0.450067 0.47544 L0.376106 0.441895 L0.264042 0.441895 L0.188966 0.47544 L0.113885 0.5435 L0.076905 0.646108 L0.076905 0.714187 L0.113885 0.815809 L0.188966 0.883886 L0.264042 0.918418 L0.376106 0.918418 L0.450067 0.883886 L0.525148 0.815809",r:"M0.107422 0.439941 L0.107422 0.960796 M0.107422 0.663164 L0.155824 0.551014 L0.252626 0.476607 L0.349428 0.439941 L0.49463 0.439941",s:"M0.475556 0.477535 L0.400757 0.439941 L0.276092 0.439941 L0.176361 0.477535 L0.101563 0.553823 L0.101563 0.630112 L0.176361 0.668808 L0.301024 0.668808 L0.425688 0.745099 L0.50049 0.821387 L0.50049 0.897677 L0.425688 0.93527 L0.325956 0.973965 L0.201295 0.973965 L0.126496 0.93527 L0.101563 0.858979",t:"M0.246032 0.297852 L0.246032 0.826549 L0.301023 0.919323 L0.411011 0.950848 L0.520997 0.950848 M0.081055 0.515799 L0.466004 0.515799",u:"M0.092041 0.454102 L0.092041 0.826134 L0.13018 0.937211 L0.205936 0.974954 L0.319832 0.974954 L0.396113 0.937211 L0.510011 0.826134 M0.510011 0.454102 L0.510011 0.974954",v:"M0.048828 0.453125 L0.301026 0.961719 M0.553224 0.453125 L0.301026 0.961719",w:"M0 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.451539 0.961719 M0.602052 0.453125 L0.451539 0.961719",x:"M0.03711 0.453125 L0.564943 0.961719 M0.564943 0.453125 L0.03711 0.961719",y:"M0.084618 0.453125 L0.320232 0.921476 M0.55713 0.453125 L0.320232 0.921476 L0.242119 1.055289 L0.163369 1.122196 L0.084618 1.155166 L0.044922 1.155166",z:"M0.505373 0.452148 L0.09668 0.961651 M0.09668 0.452148 L0.505373 0.452148 M0.09668 0.961651 L0.505373 0.961651"},lineAlphabet={};for(let letter in svgAlphabet){lineAlphabet[letter]=[];let segs=svgAlphabet[letter].split("M").slice(1).map(seg=>seg.split("L").map(pr3=>pr3.trim().split(" ").map(parseFloat)));for(let seg of segs)for(let i3=0;i3<seg.length-1;i3++)lineAlphabet[letter].push({x1:seg[i3][0],y1:1-seg[i3][1],x2:seg[i3+1][0],y2:1-seg[i3+1][1]})}}});var dist_exports3={};__export(dist_exports3,{CIRCUIT_TO_SVG_VERSION:()=>CIRCUIT_TO_SVG_VERSION,circuitJsonToPcbSvg:()=>circuitJsonToPcbSvg,circuitJsonToSchematicSvg:()=>circuitJsonToSchematicSvg,convertCircuitJsonToAssemblySvg:()=>convertCircuitJsonToAssemblySvg,convertCircuitJsonToPcbSvg:()=>convertCircuitJsonToPcbSvg,convertCircuitJsonToPinoutSvg:()=>convertCircuitJsonToPinoutSvg,convertCircuitJsonToSchematicSimulationSvg:()=>convertCircuitJsonToSchematicSimulationSvg,convertCircuitJsonToSchematicSvg:()=>convertCircuitJsonToSchematicSvg,convertCircuitJsonToSimulationGraphSvg:()=>convertCircuitJsonToSimulationGraphSvg,convertCircuitJsonToSolderPasteMask:()=>convertCircuitJsonToSolderPasteMask,createErrorTextOverlay:()=>createErrorTextOverlay,createSvgObjectsForSchComponentPortHovers:()=>createSvgObjectsForSchComponentPortHovers,getSoftwareUsedString:()=>getSoftwareUsedString,isSimulationExperiment:()=>isSimulationExperiment,isSimulationTransientVoltageGraph:()=>isSimulationTransientVoltageGraph,isSimulationVoltageProbe:()=>isSimulationVoltageProbe});function createSvgObjectsFromPcbTraceError(pcbTraceError,circuitJson,ctx){let{transform:transform6,shouldDrawErrors}=ctx;if(!shouldDrawErrors)return[];let{pcb_port_ids}=pcbTraceError,port1=circuitJson.find(el3=>el3.type==="pcb_port"&&el3.pcb_port_id===pcb_port_ids?.[0]),port2=circuitJson.find(el3=>el3.type==="pcb_port"&&el3.pcb_port_id===pcb_port_ids?.[1]);if(!port1||!port2){let viaId=pcbTraceError.message?.match(/pcb_via\[#?(pcb_via_\d+)\]/)?.[1],via=circuitJson.find(el3=>el3.type==="pcb_via"&&el3.pcb_via_id===viaId);if(via&&via.type==="pcb_via")return createSvgObjectsForViaTraceError(pcbTraceError,via,ctx);if(pcbTraceError.center){let screenCenter=applyToPoint3(transform6,{x:pcbTraceError.center.x,y:pcbTraceError.center.y});return annotateTraceErrorSvgObjects([{name:"rect",type:"element",attributes:{x:(screenCenter.x-5).toString(),y:(screenCenter.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenCenter.x} ${screenCenter.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:screenCenter.x.toString(),y:(screenCenter.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:pcbTraceError.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}])}else return[]}let screenPort1=applyToPoint3(transform6,{x:port1.x,y:port1.y}),screenPort2=applyToPoint3(transform6,{x:port2.x,y:port2.y}),errorCenter={x:(screenPort1.x+screenPort2.x)/2,y:(screenPort1.y+screenPort2.y)/2};if(isNaN(screenPort1.x)||isNaN(screenPort1.y)||isNaN(screenPort2.x)||isNaN(screenPort2.y)||isNaN(errorCenter.x)||isNaN(errorCenter.y))return[];let svgObjects=[{name:"line",type:"element",attributes:{x1:screenPort1.x.toString(),y1:screenPort1.y.toString(),x2:errorCenter.x.toString(),y2:errorCenter.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"line",type:"element",attributes:{x1:errorCenter.x.toString(),y1:errorCenter.y.toString(),x2:screenPort2.x.toString(),y2:screenPort2.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"rect",type:"element",attributes:{x:(errorCenter.x-5).toString(),y:(errorCenter.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${errorCenter.x} ${errorCenter.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:errorCenter.x.toString(),y:(errorCenter.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:pcbTraceError.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}];return annotateTraceErrorSvgObjects(svgObjects)}function createSvgObjectsForViaTraceError(pcbTraceError,via,ctx){let{transform:transform6}=ctx;if(pcbTraceError.center&&via){let screenCenter=applyToPoint3(transform6,{x:pcbTraceError.center.x,y:pcbTraceError.center.y}),screenVia=applyToPoint3(transform6,{x:via.x,y:via.y}),dx3=screenVia.x-screenCenter.x,dy3=screenVia.y-screenCenter.y,dist=Math.sqrt(dx3*dx3+dy3*dy3),angle=Math.atan2(dy3,dx3)*180/Math.PI,boxWidth=dist+10*2,boxHeight=20,midX=(screenCenter.x+screenVia.x)/2,midY=(screenCenter.y+screenVia.y)/2;return annotateTraceErrorSvgObjects([{name:"rect",type:"element",attributes:{x:(midX-boxWidth/2).toString(),y:(midY-boxHeight/2).toString(),width:boxWidth.toString(),height:boxHeight.toString(),fill:"none",stroke:"red","stroke-width":"1","stroke-dasharray":"3,2",transform:`rotate(${angle} ${midX} ${midY})`},children:[],value:""},{name:"rect",type:"element",attributes:{x:(midX-5).toString(),y:(midY-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${midX} ${midY})`},children:[],value:""},{name:"text",type:"element",attributes:{x:midX.toString(),y:(midY-boxHeight/2-5).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:pcbTraceError.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}])}return[]}function annotateTraceErrorSvgObjects(objects){return objects.map(object=>({...object,attributes:{...object.attributes??{},"data-type":object.attributes?.["data-type"]??"pcb_trace_error","data-pcb-layer":object.attributes?.["data-pcb-layer"]??"overlay"},children:(object.children??[]).map(child=>child?.type==="element"?{...child,attributes:{...child.attributes??{},"data-type":child.attributes?.["data-type"]??"pcb_trace_error","data-pcb-layer":child.attributes?.["data-pcb-layer"]??"overlay"}}:child)}))}function annotateFootprintErrorSvgObjects(objects){return objects.map(object=>({...object,attributes:{...object.attributes??{},"data-type":object.attributes?.["data-type"]??"pcb_footprint_overlap_error","data-pcb-layer":object.attributes?.["data-pcb-layer"]??"overlay"},children:(object.children??[]).map(child=>child?.type==="element"?{...child,attributes:{...child.attributes??{},"data-type":child.attributes?.["data-type"]??"pcb_footprint_overlap_error","data-pcb-layer":child.attributes?.["data-pcb-layer"]??"overlay"}}:child)}))}function createSvgObjectsFromPcbFootprintOverlapError(error2,circuitJson,ctx){let{transform:transform6,shouldDrawErrors}=ctx;if(!shouldDrawErrors)return[];let svgObjects=[],referencedElements=[],padPortIds=[];if(error2.pcb_smtpad_ids)for(let padId of error2.pcb_smtpad_ids){let pad2=circuitJson.find(el3=>el3.type==="pcb_smtpad"&&el3.pcb_smtpad_id===padId);pad2&&(referencedElements.push({x:pad2.x,y:pad2.y,type:"pcb_smtpad",id:padId,pcb_port_id:pad2.pcb_port_id}),pad2.pcb_port_id&&padPortIds.push(pad2.pcb_port_id))}let allPadsSamePort=padPortIds.length>1&&padPortIds.every(id2=>id2===padPortIds[0]),filteredReferencedElements=referencedElements;if(allPadsSamePort&&(filteredReferencedElements=referencedElements.filter(e5=>e5.type!=="pcb_smtpad")),error2.pcb_plated_hole_ids)for(let holeId of error2.pcb_plated_hole_ids){let hole=circuitJson.find(el3=>el3.type==="pcb_plated_hole"&&el3.pcb_plated_hole_id===holeId);hole&&filteredReferencedElements.push({x:hole.x,y:hole.y,type:"pcb_plated_hole",id:holeId})}if(error2.pcb_hole_ids)for(let holeId of error2.pcb_hole_ids){let hole=circuitJson.find(el3=>el3.type==="pcb_hole"&&el3.pcb_hole_id===holeId);hole&&filteredReferencedElements.push({x:hole.x,y:hole.y,type:"pcb_hole",id:holeId})}if(filteredReferencedElements.length>0){let centerX=filteredReferencedElements.reduce((sum,el3)=>sum+el3.x,0)/filteredReferencedElements.length,centerY=filteredReferencedElements.reduce((sum,el3)=>sum+el3.y,0)/filteredReferencedElements.length,screenCenter=applyToPoint3(transform6,{x:centerX,y:centerY});svgObjects.push({name:"rect",type:"element",attributes:{x:(screenCenter.x-5).toString(),y:(screenCenter.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenCenter.x} ${screenCenter.y})`},children:[],value:""}),svgObjects.push({name:"text",type:"element",attributes:{x:screenCenter.x.toString(),y:(screenCenter.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:error2.message||"PCB Footprint Overlap Error",name:"",attributes:{},children:[]}],value:""});for(let element of filteredReferencedElements){let screenPos=applyToPoint3(transform6,{x:element.x,y:element.y});svgObjects.push({name:"rect",type:"element",attributes:{x:(screenPos.x-5).toString(),y:(screenPos.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenPos.x} ${screenPos.y})`},children:[],value:""}),filteredReferencedElements.length>1&&svgObjects.push({name:"line",type:"element",attributes:{x1:screenCenter.x.toString(),y1:screenCenter.y.toString(),x2:screenPos.x.toString(),y2:screenPos.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""})}}return annotateFootprintErrorSvgObjects(svgObjects)}function createSvgObjectsFromPcbCourtyardOverlapError(error2,circuitJson,ctx){let{transform:transform6,shouldDrawErrors}=ctx;if(!shouldDrawErrors)return[];let svgObjects=[],componentCenters=[];for(let compId of error2.pcb_component_ids){let comp=circuitJson.find(el3=>el3.type==="pcb_component"&&el3.pcb_component_id===compId);comp&&componentCenters.push(comp.center)}if(componentCenters.length===0)return[];let midX=componentCenters.reduce((s3,c4)=>s3+c4.x,0)/componentCenters.length,midY=componentCenters.reduce((s3,c4)=>s3+c4.y,0)/componentCenters.length,screenMid=applyToPoint3(transform6,{x:midX,y:midY});svgObjects.push({name:"rect",type:"element",attributes:{x:(screenMid.x-5).toString(),y:(screenMid.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenMid.x} ${screenMid.y})`,"data-type":"pcb_courtyard_overlap_error","data-pcb-layer":"overlay"},children:[],value:""}),svgObjects.push({name:"text",type:"element",attributes:{x:screenMid.x.toString(),y:(screenMid.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle","data-type":"pcb_courtyard_overlap_error","data-pcb-layer":"overlay"},children:[{type:"text",value:error2.message||"PCB Courtyard Overlap",name:"",attributes:{},children:[]}],value:""});for(let center2 of componentCenters){let screenPos=applyToPoint3(transform6,center2);svgObjects.push({name:"rect",type:"element",attributes:{x:(screenPos.x-5).toString(),y:(screenPos.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenPos.x} ${screenPos.y})`,"data-type":"pcb_courtyard_overlap_error","data-pcb-layer":"overlay"},children:[],value:""})}if(componentCenters.length===2){let mapped=componentCenters.map(c4=>applyToPoint3(transform6,c4)),s12=mapped[0],s22=mapped[1];svgObjects.push({name:"line",type:"element",attributes:{x1:s12.x.toString(),y1:s12.y.toString(),x2:s22.x.toString(),y2:s22.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"4,3","data-type":"pcb_courtyard_overlap_error","data-pcb-layer":"overlay"},children:[],value:""})}return svgObjects}function annotateError(objects){return objects.map(object=>({...object,attributes:{...object.attributes??{},"data-type":object.attributes?.["data-type"]??"pcb_component_outside_board_error","data-pcb-layer":object.attributes?.["data-pcb-layer"]??"overlay"}}))}function getComponentBounds2(error2,circuitJson){let pcbComponentId=error2.pcb_component_id;if(!pcbComponentId)return error2.component_bounds??null;let pcbComponent=circuitJson.find(elm=>elm.type==="pcb_component"&&elm.pcb_component_id===pcbComponentId);return pcbComponent?.center&&pcbComponent?.width&&pcbComponent?.height?{min_x:pcbComponent.center.x-pcbComponent.width/2,max_x:pcbComponent.center.x+pcbComponent.width/2,min_y:pcbComponent.center.y-pcbComponent.height/2,max_y:pcbComponent.center.y+pcbComponent.height/2}:error2.component_bounds??null}function createSvgObjectsFromPcbComponentOutsideBoardError(error2,circuitJson,ctx){let{shouldDrawErrors,transform:transform6}=ctx;if(!shouldDrawErrors)return[];let bounds=getComponentBounds2(error2,circuitJson);if(!bounds)return[];let topLeft=applyToPoint3(transform6,{x:bounds.min_x,y:bounds.min_y}),bottomRight=applyToPoint3(transform6,{x:bounds.max_x,y:bounds.max_y}),x4=Math.min(topLeft.x,bottomRight.x),y4=Math.min(topLeft.y,bottomRight.y),width=Math.abs(bottomRight.x-topLeft.x),height=Math.abs(bottomRight.y-topLeft.y),centerX=x4+width/2,centerY=y4+height/2,svgObjects=[{type:"element",name:"rect",value:"",attributes:{x:x4.toString(),y:y4.toString(),width:width.toString(),height:height.toString(),fill:"none",stroke:"red","stroke-width":"1.5","stroke-dasharray":"4,2"},children:[]},{type:"element",name:"rect",value:"",attributes:{x:(centerX-5).toString(),y:(centerY-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${centerX} ${centerY})`},children:[]},{type:"element",name:"text",value:"",attributes:{x:centerX.toString(),y:(y4-10).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",name:"",value:error2.message??"PCB component extends outside board boundaries",attributes:{},children:[]}]}];return annotateError(svgObjects)}function annotateError2(objects){return objects.map(object=>({...object,attributes:{...object.attributes??{},"data-type":object.attributes?.["data-type"]??"pcb_via_trace_clearance_error","data-pcb-layer":object.attributes?.["data-pcb-layer"]??"overlay"}}))}function createSvgObjectsFromPcbViaTraceClearanceError(error2,_circuitJson,ctx){let{shouldDrawErrors,transform:transform6}=ctx;if(!shouldDrawErrors)return[];let center2=error2.center;if(!center2||typeof center2.x!="number"||typeof center2.y!="number")return[];let screenCenter=applyToPoint3(transform6,center2),actualClearance=error2.actual_clearance,minimumClearance=error2.minimum_clearance,defaultMessage=actualClearance&&minimumClearance?`Via/trace clearance ${actualClearance} is below minimum ${minimumClearance}`:"Via and trace too close",message=error2.message??defaultMessage,svgObjects=[{type:"element",name:"rect",value:"",attributes:{x:(screenCenter.x-5).toString(),y:(screenCenter.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenCenter.x} ${screenCenter.y})`},children:[]},{type:"element",name:"text",value:"",attributes:{x:screenCenter.x.toString(),y:(screenCenter.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",name:"",value:message,attributes:{},children:[]}]}];return annotateError2(svgObjects)}function createSvgObjectsFromPcbFabricationNotePath(fabNotePath,ctx){let{transform:transform6,layer:layerFilter}=ctx;if(!fabNotePath.route||!Array.isArray(fabNotePath.route))return[];let firstPoint=fabNotePath.route[0],lastPoint=fabNotePath.route[fabNotePath.route.length-1],isClosed=firstPoint.x===lastPoint.x&&firstPoint.y===lastPoint.y,path=fabNotePath.route.slice(0,isClosed?-1:void 0).map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ")+(isClosed?" Z":"");return[{name:"path",type:"element",attributes:{class:"pcb-fabrication-note-path",stroke:fabNotePath.color||"rgba(255,255,255,0.5)",fill:"none",d:path,"stroke-width":(fabNotePath.stroke_width*Math.abs(transform6.a)).toString(),"data-pcb-component-id":fabNotePath.pcb_component_id,"data-pcb-fabrication-note-path-id":fabNotePath.pcb_fabrication_note_path_id,"data-type":"pcb_fabrication_note_path","data-pcb-layer":"overlay"},value:"",children:[]}]}function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText,ctx){let{transform:transform6,layer:layerFilter}=ctx,{anchor_position,anchor_alignment="center",text,font_size=1,layer="top",color}=pcbFabNoteText;if(layerFilter&&layer!==layerFilter)return[];if(!anchor_position||typeof anchor_position.x!="number"||typeof anchor_position.y!="number")return debugPcb(`[pcb_fabrication_note_text] Invalid anchor_position for "${pcbFabNoteText.pcb_fabrication_note_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[anchor_position.x,anchor_position.y]),transformedFontSize=font_size*Math.abs(transform6.a),textAnchor="middle",dominantBaseline="central";switch(anchor_alignment){case"top_left":textAnchor="start",dominantBaseline="text-before-edge";break;case"top_right":textAnchor="end",dominantBaseline="text-before-edge";break;case"bottom_left":textAnchor="start",dominantBaseline="text-after-edge";break;case"bottom_right":textAnchor="end",dominantBaseline="text-after-edge";break}let textTransform=compose3(translate3(transformedX,transformedY),rotate3(Math.PI/180));return[{name:"text",type:"element",attributes:{x:"0",y:"0","font-family":"Arial, sans-serif","font-size":transformedFontSize.toString(),"text-anchor":textAnchor,"dominant-baseline":dominantBaseline,transform:toString(textTransform),class:"pcb-fabrication-note-text",fill:color||"rgba(255,255,255,0.5)","data-type":"pcb_fabrication_note_text","data-pcb-layer":"overlay"},children:[{type:"text",value:text,name:"",attributes:{},children:[]}],value:""}]}function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect,ctx){let{transform:transform6,layer:layerFilter}=ctx,{center:center2,width,height,stroke_width,is_filled,has_stroke,is_stroke_dashed,color,layer="top",pcb_component_id,pcb_fabrication_note_rect_id,corner_radius}=fabricationNoteRect;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof width!="number"||typeof height!="number")return debugPcb(`[pcb_fabrication_note_rect] Invalid data for "${pcb_fabrication_note_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center2)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`),[];let halfWidth=width/2,halfHeight=height/2,[topLeftX,topLeftY]=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]),[bottomRightX,bottomRightY]=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),rectX=Math.min(topLeftX,bottomRightX),rectY=Math.min(topLeftY,bottomRightY),rectWidth=Math.abs(bottomRightX-topLeftX),rectHeight=Math.abs(bottomRightY-topLeftY),transformedStrokeWidth=(typeof stroke_width=="number"?stroke_width:0)*Math.abs(transform6.a),overlayStrokeColor=color??DEFAULT_OVERLAY_STROKE_COLOR,baseCornerRadius=typeof corner_radius=="number"&&corner_radius>0?corner_radius:0,transformedCornerRadiusX=baseCornerRadius*Math.abs(transform6.a),transformedCornerRadiusY=baseCornerRadius*Math.abs(transform6.d),attributes2={x:rectX.toString(),y:rectY.toString(),width:rectWidth.toString(),height:rectHeight.toString(),class:"pcb-fabrication-note-rect","data-type":"pcb_fabrication_note_rect","data-pcb-fabrication-note-rect-id":pcb_fabrication_note_rect_id,"data-pcb-layer":"overlay"};if(pcb_component_id!==void 0&&(attributes2["data-pcb-component-id"]=pcb_component_id),transformedCornerRadiusX>0&&(attributes2.rx=transformedCornerRadiusX.toString()),transformedCornerRadiusY>0&&(attributes2.ry=transformedCornerRadiusY.toString()),is_filled?attributes2.fill=color??DEFAULT_OVERLAY_FILL_COLOR:attributes2.fill="none",has_stroke??transformedStrokeWidth>0){if(attributes2.stroke=overlayStrokeColor,attributes2["stroke-width"]=transformedStrokeWidth.toString(),is_stroke_dashed){let dash=.2*Math.abs(transform6.a),gap=.1*Math.abs(transform6.a);attributes2["stroke-dasharray"]=`${dash} ${gap}`}}else attributes2.stroke="none";return[{name:"rect",type:"element",value:"",attributes:attributes2,children:[]}]}function normalize(vector2){let length4=Math.hypot(vector2.x,vector2.y)||1;return{x:vector2.x/length4,y:vector2.y/length4}}function toPath(points){return points.map((point7,index)=>index===0?`M ${point7.x} ${point7.y}`:`L ${point7.x} ${point7.y}`).join(" ")}function createSvgObjectsFromPcbFabricationNoteDimension(dimension,ctx){let{transform:transform6,layer:layerFilter}=ctx,{from,to:to3,text,font_size=1,color,arrow_size,layer,pcb_component_id,pcb_fabrication_note_dimension_id,offset_distance,offset_direction,text_ccw_rotation}=dimension;if(layerFilter&&layer&&layer!==layerFilter)return[];if(!from||!to3||typeof from!="object"||typeof to3!="object")return debugPcb(`[pcb_fabrication_note_dimension] Invalid endpoints for "${pcb_fabrication_note_dimension_id}": expected {from: {x, y}, to: {x, y}}, got from=${JSON.stringify(from)}, to=${JSON.stringify(to3)}`),[];if(typeof from.x!="number"||typeof from.y!="number"||typeof to3.x!="number"||typeof to3.y!="number")return debugPcb(`[pcb_fabrication_note_dimension] Invalid point values for "${pcb_fabrication_note_dimension_id}": x and y must be numbers, got from=${JSON.stringify(from)}, to=${JSON.stringify(to3)}`),[];let numericArrowSize=typeof arrow_size=="number"?arrow_size:void 0;if(numericArrowSize===void 0||!Number.isFinite(numericArrowSize)||numericArrowSize<=0)return debugPcb(`[pcb_fabrication_note_dimension] Invalid arrow_size for "${pcb_fabrication_note_dimension_id}": expected positive number, got ${JSON.stringify(arrow_size)}`),[];let arrowSize=numericArrowSize,direction2=normalize({x:to3.x-from.x,y:to3.y-from.y});if(Number.isNaN(direction2.x)||Number.isNaN(direction2.y))return[];let perpendicular={x:-direction2.y,y:direction2.x},hasOffsetDirection=offset_direction&&typeof offset_direction.x=="number"&&typeof offset_direction.y=="number",normalizedOffsetDirection=hasOffsetDirection?normalize({x:offset_direction.x,y:offset_direction.y}):{x:0,y:0},offsetMagnitude=typeof offset_distance=="number"?offset_distance:0,offsetVector={x:normalizedOffsetDirection.x*offsetMagnitude,y:normalizedOffsetDirection.y*offsetMagnitude},applyOffset=point7=>({x:point7.x+offsetVector.x,y:point7.y+offsetVector.y}),fromOffset=applyOffset(from),toOffset=applyOffset(to3),arrowHalfWidth=arrowSize/2,fromBase={x:fromOffset.x+direction2.x*arrowSize,y:fromOffset.y+direction2.y*arrowSize},toBase={x:toOffset.x-direction2.x*arrowSize,y:toOffset.y-direction2.y*arrowSize},fromTriangle=[toScreen(fromOffset),toScreen({x:fromBase.x+perpendicular.x*arrowHalfWidth,y:fromBase.y+perpendicular.y*arrowHalfWidth}),toScreen({x:fromBase.x-perpendicular.x*arrowHalfWidth,y:fromBase.y-perpendicular.y*arrowHalfWidth})],toTriangle=[toScreen(toOffset),toScreen({x:toBase.x+perpendicular.x*arrowHalfWidth,y:toBase.y+perpendicular.y*arrowHalfWidth}),toScreen({x:toBase.x-perpendicular.x*arrowHalfWidth,y:toBase.y-perpendicular.y*arrowHalfWidth})],[lineStartX,lineStartY]=applyToPoint3(transform6,[fromBase.x,fromBase.y]),[lineEndX,lineEndY]=applyToPoint3(transform6,[toBase.x,toBase.y]),strokeWidth=arrowSize/5*Math.abs(transform6.a),lineColor=color||"rgba(255,255,255,0.5)",extensionDirection=hasOffsetDirection&&(Math.abs(normalizedOffsetDirection.x)>Number.EPSILON||Math.abs(normalizedOffsetDirection.y)>Number.EPSILON)?normalizedOffsetDirection:perpendicular,extensionLength=offsetMagnitude+arrowSize,createExtensionLine=anchor=>{let endPoint={x:anchor.x+extensionDirection.x*extensionLength,y:anchor.y+extensionDirection.y*extensionLength},[startX,startY]=applyToPoint3(transform6,[anchor.x,anchor.y]),[endX,endY]=applyToPoint3(transform6,[endPoint.x,endPoint.y]);return{name:"path",type:"element",value:"",attributes:{d:`M ${startX} ${startY} L ${endX} ${endY}`,stroke:lineColor,fill:"none","stroke-width":strokeWidth.toString(),"stroke-linecap":"round",class:"pcb-fabrication-note-dimension-extension"},children:[]}},extensionSegments=[createExtensionLine(from),createExtensionLine(to3)],midPoint2={x:(from.x+to3.x)/2+offsetVector.x,y:(from.y+to3.y)/2+offsetVector.y},[screenFromX,screenFromY]=applyToPoint3(transform6,[fromOffset.x,fromOffset.y]),[screenToX,screenToY]=applyToPoint3(transform6,[toOffset.x,toOffset.y]),screenDirection=normalize({x:screenToX-screenFromX,y:screenToY-screenFromY}),textAngle=Math.atan2(screenDirection.y,screenDirection.x)*180/Math.PI;(textAngle>90||textAngle<-90)&&(textAngle+=180);let finalTextAngle=typeof text_ccw_rotation=="number"&&Number.isFinite(text_ccw_rotation)?textAngle-text_ccw_rotation:textAngle,additionalOffset=0;if(text&&typeof text_ccw_rotation=="number"&&Number.isFinite(text_ccw_rotation)){let textWidth=text.length*font_size*CHARACTER_WIDTH_MULTIPLIER,textHeight=font_size,rotationRad=text_ccw_rotation*Math.PI/180,sinRot=Math.abs(Math.sin(rotationRad)),cosRot=Math.abs(Math.cos(rotationRad)),halfWidth=textWidth/2,halfHeight=textHeight/2;additionalOffset=halfWidth*sinRot+halfHeight*cosRot+font_size*TEXT_INTERSECTION_PADDING_MULTIPLIER}let textOffset=arrowSize*TEXT_OFFSET_MULTIPLIER+additionalOffset,textPoint={x:midPoint2.x+perpendicular.x*textOffset,y:midPoint2.y+perpendicular.y*textOffset},[textX,textY]=applyToPoint3(transform6,[textPoint.x,textPoint.y]),transformedFontSize=font_size*Math.abs(transform6.a),children=[...extensionSegments,{name:"path",type:"element",value:"",attributes:{d:`M ${lineStartX} ${lineStartY} L ${lineEndX} ${lineEndY}`,stroke:lineColor,fill:"none","stroke-width":strokeWidth.toString(),"stroke-linecap":"round",class:"pcb-fabrication-note-dimension-line"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${toPath(fromTriangle)} Z`,fill:lineColor,class:"pcb-fabrication-note-dimension-arrow"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${toPath(toTriangle)} Z`,fill:lineColor,class:"pcb-fabrication-note-dimension-arrow"},children:[]}];text&&children.push({name:"text",type:"element",value:"",attributes:{x:textX.toString(),y:textY.toString(),fill:lineColor,"font-size":transformedFontSize.toString(),"font-family":"Arial, sans-serif","text-anchor":"middle","dominant-baseline":"central",class:"pcb-fabrication-note-dimension-text",transform:`rotate(${finalTextAngle} ${textX} ${textY})`},children:[{type:"text",name:"",value:text,attributes:{},children:[]}]});let attributes2={class:"pcb-fabrication-note-dimension","data-type":"pcb_fabrication_note_dimension","data-pcb-fabrication-note-dimension-id":pcb_fabrication_note_dimension_id,"data-pcb-layer":layer??"overlay"};return pcb_component_id!==void 0&&(attributes2["data-pcb-component-id"]=pcb_component_id),[{name:"g",type:"element",value:"",attributes:attributes2,children}];function toScreen(point7){let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return{x:x4,y:y4}}}function normalize2(vector2){let length4=Math.hypot(vector2.x,vector2.y)||1;return{x:vector2.x/length4,y:vector2.y/length4}}function toPath2(points){return points.map((point7,index)=>index===0?`M ${point7.x} ${point7.y}`:`L ${point7.x} ${point7.y}`).join(" ")}function createSvgObjectsFromPcbNoteDimension(dimension,ctx){let{transform:transform6}=ctx,{from,to:to3,text,font_size=1,color,arrow_size,offset_distance,offset_direction,text_ccw_rotation}=dimension;if(!from||!to3)return debugPcb(`[pcb_note_dimension] Invalid endpoints for "${dimension.pcb_note_dimension_id}": expected {from: {x, y}, to: {x, y}}, got from=${JSON.stringify(from)}, to=${JSON.stringify(to3)}`),[];if(!Number.isFinite(arrow_size)||arrow_size<=0)return debugPcb(`[pcb_note_dimension] Invalid arrow_size for "${dimension.pcb_note_dimension_id}": expected positive number, got ${JSON.stringify(arrow_size)}`),[];let direction2=normalize2({x:to3.x-from.x,y:to3.y-from.y});if(Number.isNaN(direction2.x)||Number.isNaN(direction2.y))return[];let perpendicular={x:-direction2.y,y:direction2.x},hasOffsetDirection=offset_direction&&typeof offset_direction.x=="number"&&typeof offset_direction.y=="number",normalizedOffsetDirection=hasOffsetDirection?normalize2({x:offset_direction.x,y:offset_direction.y}):{x:0,y:0},offsetMagnitude=typeof offset_distance=="number"?offset_distance:0,offsetVector={x:normalizedOffsetDirection.x*offsetMagnitude,y:normalizedOffsetDirection.y*offsetMagnitude},applyOffset=point7=>({x:point7.x+offsetVector.x,y:point7.y+offsetVector.y}),fromOffset=applyOffset(from),toOffset=applyOffset(to3),arrowHalfWidth=arrow_size/2,fromBase={x:fromOffset.x+direction2.x*arrow_size,y:fromOffset.y+direction2.y*arrow_size},toBase={x:toOffset.x-direction2.x*arrow_size,y:toOffset.y-direction2.y*arrow_size},fromTriangle=[toScreen(fromOffset),toScreen({x:fromBase.x+perpendicular.x*arrowHalfWidth,y:fromBase.y+perpendicular.y*arrowHalfWidth}),toScreen({x:fromBase.x-perpendicular.x*arrowHalfWidth,y:fromBase.y-perpendicular.y*arrowHalfWidth})],toTriangle=[toScreen(toOffset),toScreen({x:toBase.x+perpendicular.x*arrowHalfWidth,y:toBase.y+perpendicular.y*arrowHalfWidth}),toScreen({x:toBase.x-perpendicular.x*arrowHalfWidth,y:toBase.y-perpendicular.y*arrowHalfWidth})],[lineStartX,lineStartY]=applyToPoint3(transform6,[fromBase.x,fromBase.y]),[lineEndX,lineEndY]=applyToPoint3(transform6,[toBase.x,toBase.y]),strokeWidth=arrow_size/5*Math.abs(transform6.a),lineColor=color||colorMap.board.user_2,extensionDirection=hasOffsetDirection&&(Math.abs(normalizedOffsetDirection.x)>Number.EPSILON||Math.abs(normalizedOffsetDirection.y)>Number.EPSILON)?normalizedOffsetDirection:perpendicular,extensionLength=offsetMagnitude+arrow_size,createExtensionLine=anchor=>{let endPoint={x:anchor.x+extensionDirection.x*extensionLength,y:anchor.y+extensionDirection.y*extensionLength},[startX,startY]=applyToPoint3(transform6,[anchor.x,anchor.y]),[endX,endY]=applyToPoint3(transform6,[endPoint.x,endPoint.y]);return{name:"path",type:"element",value:"",attributes:{d:`M ${startX} ${startY} L ${endX} ${endY}`,stroke:lineColor,fill:"none","stroke-width":strokeWidth.toString(),"stroke-linecap":"round",class:"pcb-note-dimension-extension"},children:[]}},extensionSegments=[createExtensionLine(from),createExtensionLine(to3)],midPoint2={x:(from.x+to3.x)/2+offsetVector.x,y:(from.y+to3.y)/2+offsetVector.y},[screenFromX,screenFromY]=applyToPoint3(transform6,[fromOffset.x,fromOffset.y]),[screenToX,screenToY]=applyToPoint3(transform6,[toOffset.x,toOffset.y]),screenDirection=normalize2({x:screenToX-screenFromX,y:screenToY-screenFromY}),textAngle=Math.atan2(screenDirection.y,screenDirection.x)*180/Math.PI;(textAngle>90||textAngle<-90)&&(textAngle+=180);let finalTextAngle=typeof text_ccw_rotation=="number"&&Number.isFinite(text_ccw_rotation)?textAngle-text_ccw_rotation:textAngle,additionalOffset=0;if(text&&typeof text_ccw_rotation=="number"&&Number.isFinite(text_ccw_rotation)){let textWidth=text.length*font_size*.6,textHeight=font_size,rotationRad=text_ccw_rotation*Math.PI/180,sinRot=Math.abs(Math.sin(rotationRad)),cosRot=Math.abs(Math.cos(rotationRad)),halfWidth=textWidth/2,halfHeight=textHeight/2;additionalOffset=halfWidth*sinRot+halfHeight*cosRot+font_size*.3}let textOffset=arrow_size*1.5+additionalOffset,textPoint={x:midPoint2.x+perpendicular.x*textOffset,y:midPoint2.y+perpendicular.y*textOffset},[textX,textY]=applyToPoint3(transform6,[textPoint.x,textPoint.y]),transformedFontSize=font_size*Math.abs(transform6.a),children=[...extensionSegments,{name:"path",type:"element",value:"",attributes:{d:`M ${lineStartX} ${lineStartY} L ${lineEndX} ${lineEndY}`,stroke:lineColor,fill:"none","stroke-width":strokeWidth.toString(),"stroke-linecap":"round",class:"pcb-note-dimension-line"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${toPath2(fromTriangle)} Z`,fill:lineColor,class:"pcb-note-dimension-arrow"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${toPath2(toTriangle)} Z`,fill:lineColor,class:"pcb-note-dimension-arrow"},children:[]}];return text&&children.push({name:"text",type:"element",value:"",attributes:{x:textX.toString(),y:textY.toString(),fill:lineColor,"font-size":transformedFontSize.toString(),"font-family":"Arial, sans-serif","text-anchor":"middle","dominant-baseline":"central",class:"pcb-note-dimension-text",transform:`rotate(${finalTextAngle} ${textX} ${textY})`},children:[{type:"text",name:"",value:text,attributes:{},children:[]}]}),[{name:"g",type:"element",value:"",attributes:{class:"pcb-note-dimension","data-type":"pcb_note_dimension","data-pcb-note-dimension-id":dimension.pcb_note_dimension_id,"data-pcb-layer":"overlay"},children}];function toScreen(point7){let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return{x:x4,y:y4}}}function createSvgObjectsFromPcbNoteText(note,ctx){let{transform:transform6}=ctx,{anchor_position,text,font_size=1,anchor_alignment="center",color}=note;if(!anchor_position||typeof anchor_position.x!="number"||typeof anchor_position.y!="number")return debugPcb(`[pcb_note_text] Invalid anchor_position for "${note.pcb_note_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`),[];if(typeof text!="string"||text.length===0)return debugPcb(`[pcb_note_text] Invalid text for "${note.pcb_note_text_id}": expected non-empty string, got ${JSON.stringify(text)}`),[];let[x4,y4]=applyToPoint3(transform6,[anchor_position.x,anchor_position.y]),transformedFontSize=font_size*Math.abs(transform6.a),textAnchor="middle",dominantBaseline="central";switch(anchor_alignment){case"top_left":textAnchor="start",dominantBaseline="text-before-edge";break;case"top_right":textAnchor="end",dominantBaseline="text-before-edge";break;case"bottom_left":textAnchor="start",dominantBaseline="text-after-edge";break;case"bottom_right":textAnchor="end",dominantBaseline="text-after-edge";break;default:textAnchor="middle",dominantBaseline="central";break}let lines=text.split(`
|
|
225
|
+
at `+loc}return str};peg$SyntaxError2.buildMessage=function(expected,found){var DESCRIBE_EXPECTATION_FNS={literal:function(expectation){return'"'+literalEscape(expectation.text)+'"'},class:function(expectation){var escapedParts=expectation.parts.map(function(part){return Array.isArray(part)?classEscape(part[0])+"-"+classEscape(part[1]):classEscape(part)});return"["+(expectation.inverted?"^":"")+escapedParts.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(expectation){return expectation.description}};function hex(ch3){return ch3.charCodeAt(0).toString(16).toUpperCase()}function literalEscape(s3){return s3.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch3){return"\\x0"+hex(ch3)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch3){return"\\x"+hex(ch3)})}function classEscape(s3){return s3.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch3){return"\\x0"+hex(ch3)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch3){return"\\x"+hex(ch3)})}function describeExpectation(expectation){return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation)}function describeExpected(expected2){var descriptions=expected2.map(describeExpectation),i3,j4;if(descriptions.sort(),descriptions.length>0){for(i3=1,j4=1;i3<descriptions.length;i3++)descriptions[i3-1]!==descriptions[i3]&&(descriptions[j4]=descriptions[i3],j4++);descriptions.length=j4}switch(descriptions.length){case 1:return descriptions[0];case 2:return descriptions[0]+" or "+descriptions[1];default:return descriptions.slice(0,-1).join(", ")+", or "+descriptions[descriptions.length-1]}}function describeFound(found2){return found2?'"'+literalEscape(found2)+'"':"end of input"}return"Expected "+describeExpected(expected)+" but "+describeFound(found)+" found."}}});var init_fromTransformAttribute2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromTransformAttribute.js"(){"use strict";init_fromTransformAttribute_autogenerated2()}});var init_decompose2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/decompose.js"(){"use strict";init_scale2();init_transform2()}});var init_flip2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/flip.js"(){"use strict"}});var init_fromMovingPoints2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/fromMovingPoints.js"(){"use strict";init_translate2();init_applyToPoint2();init_rotate2();init_scale2();init_transform2()}});var init_src2=__esm({"node_modules/circuit-to-svg/node_modules/transformation-matrix/src/index.js"(){"use strict";init_applyToPoint2();init_fromObject2();init_fromString2();init_identity2();init_inverse2();init_isAffineMatrix2();init_rotate2();init_scale2();init_shear2();init_skew2();init_toString2();init_transform2();init_translate2();init_fromTriangles2();init_smoothMatrix2();init_fromDefinition2();init_fromTransformAttribute2();init_decompose2();init_flip2();init_fromMovingPoints2()}});var svgAlphabet,lineAlphabet,init_dist7=__esm({"node_modules/@tscircuit/alphabet/dist/index.js"(){"use strict";svgAlphabet={0:"M0.301025 0.257813 L0.206593 0.283385 L0.122042 0.361307 L0.075923 0.474441 L0.064942 0.642221 L0.091296 0.78289 L0.159376 0.899463 L0.257104 0.961214 L0.344948 0.961214 L0.442678 0.899463 L0.510757 0.78289 L0.537111 0.642221 L0.526131 0.474441 L0.480012 0.361307 L0.39546 0.283385 L0.301025 0.257813",1:"M0.220426 0.40845 L0.381626 0.270996 L0.381626 0.948966",2:"M0.110409 0.39212 L0.125621 0.342293 L0.170571 0.295823 L0.244237 0.26431 L0.291518 0.257813 L0.373319 0.263799 L0.434683 0.290705 L0.468239 0.331966 L0.480292 0.379913 L0.479492 0.411806 L0.465088 0.465192 L0.402571 0.568988 L0.245134 0.766438 L0.07959 0.948045 L0.522462 0.948045",3:"M0.081606 0.345073 L0.119154 0.315633 L0.178996 0.284091 L0.255265 0.257813 L0.349133 0.263062 L0.43127 0.289348 L0.48994 0.336662 L0.525141 0.394491 L0.513407 0.457577 L0.466472 0.504892 L0.384334 0.541692 L0.290464 0.56272 L0.20833 0.573235 L0.290464 0.583749 L0.384334 0.610035 L0.466472 0.652092 L0.519274 0.709922 L0.531007 0.773007 L0.50754 0.841351 L0.454738 0.899179 L0.3726 0.946494 L0.310412 0.961214 L0.209503 0.959111 L0.127367 0.946494 L0.071046 0.929671",4:"M0.418494 0.270996 L0.048828 0.724199 L0.553224 0.724199 M0.414181 0.578167 L0.414181 0.94897",5:"M0.074951 0.270996 L0.074951 0.614701 L0.267655 0.5695 L0.405247 0.586502 L0.460002 0.617189 L0.498028 0.660731 L0.527101 0.779401 L0.513352 0.841049 L0.477274 0.889568 L0.406378 0.93463 L0.324445 0.958337 L0.247399 0.962139 L0.182516 0.949767 L0.130068 0.925508 L0.074951 0.875607 M0.074951 0.270996 L0.527101 0.270996",6:"M0.428549 0.257813 L0.341433 0.285053 L0.26073 0.312099 L0.192188 0.360182 L0.138902 0.410969 L0.098219 0.500422 L0.070249 0.584267 L0.067264 0.670716 L0.065164 0.756863 L0.087163 0.820973 L0.108168 0.861042 L0.157916 0.913131 L0.210981 0.948192 L0.29279 0.961214 L0.384548 0.956206 L0.456409 0.924151 L0.507262 0.881077 L0.5349 0.821975 L0.537111 0.771889 L0.521634 0.718798 L0.498418 0.67372 L0.463042 0.636657 L0.414398 0.613617 L0.34696 0.598591 L0.28284 0.595587 L0.215403 0.605604 L0.145756 0.641665 L0.109274 0.678729 L0.064942 0.724006",7:"M0.071534 0.270996 L0.530519 0.270996 L0.495935 0.291702 L0.477752 0.305407 L0.435186 0.346112 L0.412067 0.374136 L0.388565 0.40796 L0.365315 0.448098 L0.342943 0.495062 L0.322081 0.549366 L0.303364 0.611524 L0.287416 0.68205 L0.270077 0.80465 L0.26253 0.94897",8:"M0.286761 0.257813 L0.210684 0.27162 L0.1414 0.305622 L0.092494 0.382125 L0.111513 0.450128 L0.16857 0.502193 L0.228345 0.539382 L0.377781 0.594635 L0.470161 0.645637 L0.52586 0.706203 L0.538087 0.792269 L0.506841 0.87621 L0.438915 0.927212 L0.339743 0.961214 L0.263666 0.959089 L0.174004 0.929337 L0.102003 0.881523 L0.063965 0.811395 L0.066682 0.741266 L0.102003 0.671139 L0.180797 0.608448 L0.259591 0.580822 L0.358762 0.548945 L0.456576 0.49688 L0.486463 0.446941 L0.487822 0.362999 L0.453859 0.302434 L0.384574 0.265245 L0.286761 0.257813",9:"M0.511026 0.437812 L0.491026 0.347812 L0.451026 0.297812 L0.391026 0.267812 L0.311026 0.257813 L0.231026 0.267812 L0.161026 0.297812 L0.111026 0.347812 L0.091026 0.417812 L0.111026 0.487812 L0.161026 0.537812 L0.231026 0.567812 L0.311026 0.577812 L0.391026 0.557812 L0.451026 0.517812 L0.491026 0.477812 L0.511026 0.437812 M0.510026 0.438812 L0.434026 0.636812 L0.381026 0.777812 L0.337026 0.879812 L0.301026 0.957812","!":"M0.301026 0.270996 L0.301026 0.749566 M0.251466 0.94897 L0.350587 0.94897",'"':"M0.16504 0.270996 L0.16504 0.523022 M0.437013 0.270996 L0.437013 0.523022","#":"M0.20958 0.282227 L0.146515 0.949754 M0.461844 0.282227 L0.398779 0.949754 M0.032999 0.526969 L0.600587 0.452796 M0.001465 0.82366 L0.569055 0.749486",$:"M0.307121 0.240234 L0.307121 1.083502 M0.490031 0.415915 L0.404676 0.328075 L0.23396 0.310507 L0.136407 0.398347 L0.099828 0.521324 L0.124213 0.591596 L0.197379 0.644299 L0.429061 0.697003 L0.502224 0.749708 L0.526613 0.837547 L0.477836 0.960526 L0.355897 1.013228 L0.197379 0.99566 L0.112021 0.942957 L0.07544 0.837547","'":"M0.301026 0.270996 L0.301026 0.523022","(":"M0.413087 0.241211 L0.372337 0.28347 L0.331589 0.334184 L0.290838 0.393349 L0.25009 0.460965 L0.219528 0.528584 L0.199153 0.5962 L0.188966 0.655364 L0.199153 0.714529 L0.219528 0.782146 L0.25009 0.849764 L0.290838 0.91738 L0.331589 0.976544 L0.372337 1.027258 L0.413087 1.069491",")":"M0.188966 0.241211 L0.229716 0.28347 L0.270466 0.334184 L0.311213 0.393349 L0.351964 0.460965 L0.382526 0.528584 L0.4029 0.5962 L0.413087 0.655364 L0.4029 0.714529 L0.382526 0.782146 L0.351964 0.849764 L0.311213 0.91738 L0.270466 0.976544 L0.229716 1.027258 L0.188966 1.069491","*":"M0.301026 0.458702 L0.301026 0.681942 M0.301026 0.458702 L0.520997 0.536834 M0.301026 0.458702 L0.439954 0.257813 M0.301026 0.458702 L0.162098 0.257813 M0.301026 0.458702 L0.081055 0.536834","+":"M0.042969 0.66845 L0.559083 0.66845 M0.301023 0.428223 L0.301023 0.908661",",":"M0.38672 0.852051 L0.215333 1.030661 L0.301025 1.119971","-":"M0.173829 0.686035 L0.428224 0.686035",".":"M0.362549 0.851074 L0.239503 0.851074","/":"M0.062501 1.035249 L0.539551 0.270996","<":"M0.559083 0.441895 L0.042969 0.66939 L0.042969 0.66939 L0.559083 0.896902","=":"M0.042969 0.545898 L0.559083 0.545898 M0.042969 0.80837 L0.559083 0.80837",">":"M0.042969 0.441895 L0.559083 0.66939 L0.559083 0.66939 L0.042969 0.896902",A:"M0.018067 0.94897 L0.290179 0.270996 L0.583986 0.94897 M0.155303 0.684521 L0.433548 0.684521",B:"M0.063965 0.94897 L0.063965 0.278953 L0.209356 0.270996 L0.342486 0.294394 L0.432179 0.37292 L0.418224 0.48773 L0.312686 0.549166 L0.084728 0.575531 L0.306377 0.589434 L0.468877 0.647456 L0.538087 0.736658 L0.5324 0.85202 L0.501247 0.902983 L0.42355 0.944398 L0.063965 0.94897",C:"M0.529054 0.419847 L0.498425 0.345196 L0.442238 0.292341 L0.33583 0.257813 L0.257199 0.268357 L0.187906 0.303748 L0.120243 0.385432 L0.072998 0.599844 L0.110073 0.815385 L0.165381 0.902183 L0.222883 0.942801 L0.334904 0.961214 L0.43253 0.937679 L0.504816 0.868999 L0.529054 0.772065",D:"M0.064454 0.94897 L0.071838 0.285078 L0.171217 0.270996 L0.247348 0.272633 L0.37101 0.306078 L0.462461 0.378304 L0.514748 0.475555 L0.535591 0.576392 L0.537599 0.652313 L0.528065 0.717381 L0.508562 0.772419 L0.445948 0.855695 L0.362356 0.90871 L0.225203 0.945862 L0.064454 0.94897",E:"M0.080078 0.270996 L0.080078 0.94897 M0.080078 0.270996 L0.521974 0.270996 M0.080078 0.609981 L0.389405 0.609981 M0.080078 0.94897 L0.521974 0.94897",F:"M0.086426 0.270996 L0.086426 0.94897 M0.091304 0.275607 L0.515626 0.275607 M0.091304 0.607677 L0.447344 0.607677",G:"M0.498034 0.284943 L0.374621 0.257813 L0.244219 0.268648 L0.160577 0.311997 L0.094556 0.398116 L0.056397 0.58404 L0.076752 0.785532 L0.120865 0.858197 L0.188947 0.916734 L0.271008 0.953591 L0.357069 0.961214 L0.43715 0.932047 L0.501262 0.858539 L0.545656 0.648611 L0.329595 0.648131",H:"M0.066895 0.270996 L0.066895 0.94897 M0.066895 0.595658 L0.530009 0.595658 M0.535157 0.270996 L0.535157 0.94897",I:"M0.301026 0.270996 L0.301026 0.94897",J:"M0.506839 0.270996 L0.507814 0.782193 L0.498468 0.846168 L0.480733 0.880789 L0.455864 0.90832 L0.426095 0.929408 L0.360746 0.954812 L0.302508 0.962139 L0.223573 0.953638 L0.16538 0.930312 L0.137072 0.907715 L0.116428 0.880312 L0.102822 0.848819 L0.095633 0.813947 L0.094239 0.776413",K:"M0.035401 0.270996 L0.035401 0.94897 M0.502258 0.316194 L0.035401 0.687823 M0.212484 0.582361 L0.566652 0.933903",L:"M0.07544 0.270996 L0.07544 0.94897 L0.526613 0.94897",M:"M0.042481 0.94897 L0.042481 0.270996 L0.301027 0.712492 L0.559571 0.270996 L0.559571 0.94897",N:"M0.067871 0.94897 L0.067871 0.270996 L0.534181 0.94897 L0.525031 0.270996",O:"M0.287293 0.961214 L0.19843 0.933567 L0.1172 0.849451 L0.057129 0.563945 L0.114348 0.350255 L0.18455 0.289392 L0.306101 0.257813 L0.42054 0.29572 L0.487543 0.365003 L0.544923 0.625294 L0.516366 0.789624 L0.465476 0.884596 L0.375084 0.949287 L0.287293 0.961214",P:"M0.070557 0.94897 L0.070557 0.28379 L0.20704 0.270996 L0.329134 0.278993 L0.408525 0.300514 L0.444022 0.317908 L0.500637 0.368929 L0.525796 0.423728 L0.531496 0.50384 L0.508934 0.554205 L0.473724 0.582043 L0.417577 0.604365 L0.336375 0.620372 L0.226014 0.629268 L0.082368 0.630258",Q:"M0.282435 1.050813 L0.195447 1.019646 L0.115933 0.924817 L0.057129 0.602943 L0.113139 0.362034 L0.18186 0.293418 L0.300844 0.257813 L0.412868 0.300553 L0.478457 0.37866 L0.534625 0.672103 L0.506671 0.857367 L0.456855 0.964437 L0.368371 1.037368 L0.282435 1.050813 M0.341225 0.815559 L0.544923 1.070653",R:"M0.034912 0.944112 L0.034912 0.288556 L0.227127 0.270996 L0.362038 0.276867 L0.443423 0.294907 L0.477644 0.309614 L0.505809 0.328757 L0.526616 0.352817 L0.544963 0.418061 L0.543241 0.475921 L0.524463 0.517817 L0.49076 0.546518 L0.444265 0.564799 L0.355195 0.578739 L0.047653 0.589627 M0.303054 0.617306 L0.56714 0.94897",S:"M0.483037 0.364333 L0.407613 0.267477 L0.22883 0.257813 L0.128623 0.327565 L0.087712 0.455539 L0.104656 0.518727 L0.168054 0.573307 L0.41928 0.617318 L0.503796 0.669342 L0.535157 0.759324 L0.493846 0.900055 L0.367668 0.961214 L0.205436 0.956661 L0.116711 0.907038 L0.066895 0.790334",T:"M0.022949 0.270996 L0.579103 0.270996 M0.309284 0.270996 L0.309284 0.94897",U:"M0.072022 0.270996 L0.07308 0.648875 L0.080372 0.75167 L0.099024 0.827813 L0.134786 0.885729 L0.181571 0.924023 L0.251464 0.95168 L0.339655 0.962139 L0.401553 0.951668 L0.45232 0.924086 L0.482701 0.891771 L0.495745 0.870529 L0.515699 0.81637 L0.525014 0.744626 L0.530031 0.272017",V:"M0.027832 0.270996 L0.320083 0.94897 L0.57422 0.270996",W:"M0 0.270996 L0.079799 0.940377 L0.285198 0.472884 L0.505255 0.94897 L0.602052 0.270996",X:"M0.009034 0.270996 L0.586805 0.94897 M0.593019 0.270996 L0.015246 0.94897",Y:"M0.018067 0.270996 L0.293132 0.574135 M0.583986 0.271959 L0.294954 0.57606 L0.305277 0.94897",Z:"M0.053711 0.270996 L0.548341 0.270996 L0.053711 0.94897 L0.548341 0.94897","[":"M0.404542 0.240234 L0.197511 0.240234 L0.197511 1.069424 L0.404542 1.069424","\\":"M0.062501 0.270996 L0.539551 1.035249","]":"M0.19751 0.240234 L0.404542 0.240234 L0.404542 1.069424 L0.19751 1.069424","^":"M0.035156 0.523931 L0.301024 0.270996 L0.566896 0.523931",_:"M0 1.160601 L0.602052 1.160601",a:"M0.527101 0.439941 L0.527101 0.973965 M0.527101 0.553824 L0.451366 0.477535 L0.376759 0.439941 L0.263722 0.439941 L0.187989 0.477535 L0.112255 0.553824 L0.074951 0.66881 L0.074951 0.745099 L0.112255 0.85898 L0.187989 0.93527 L0.263722 0.973965 L0.376759 0.973965 L0.451366 0.93527 L0.527101 0.85898",b:"M0.07666 0.240234 L0.07666 0.959985 M0.07666 0.582737 L0.151822 0.514237 L0.225865 0.480483 L0.338045 0.480483 L0.413211 0.514237 L0.488374 0.582737 L0.525392 0.685983 L0.525392 0.754485 L0.488374 0.856739 L0.413211 0.92524 L0.338045 0.959985 L0.225865 0.959985 L0.151822 0.92524 L0.07666 0.856739",c:"M0.512452 0.553823 L0.441624 0.477535 L0.371854 0.439941 L0.26614 0.439941 L0.195312 0.477535 L0.124486 0.553823 L0.0896 0.668808 L0.0896 0.745099 L0.124486 0.858979 L0.195312 0.93527 L0.26614 0.973965 L0.371854 0.973965 L0.441624 0.93527 L0.512452 0.858979",d:"M0.525392 0.240234 L0.525392 0.959985 M0.525392 0.582737 L0.450232 0.514237 L0.376189 0.480483 L0.264006 0.480483 L0.188844 0.514237 L0.11368 0.582737 L0.076661 0.685983 L0.076661 0.754485 L0.11368 0.856739 L0.188844 0.92524 L0.264006 0.959985 L0.376189 0.959985 L0.450232 0.92524 L0.525392 0.856739",e:"M0.059571 0.668808 L0.542482 0.668808 M0.542482 0.592521 L0.502641 0.516231 L0.461594 0.477535 L0.381914 0.439941 L0.261186 0.439941 L0.180299 0.477535 L0.099412 0.553823 L0.059571 0.668808 L0.059571 0.745099 L0.099412 0.858979 L0.180299 0.93527 L0.261186 0.973965 L0.381914 0.973965 L0.461594 0.93527 L0.542482 0.858979",f:"M0.512941 0.240234 L0.406984 0.240234 L0.301026 0.274346 L0.248047 0.374731 L0.248047 0.946817 M0.089112 0.476088 L0.459965 0.476088",g:"M0.525392 0.439941 L0.525392 0.989395 L0.488373 1.091918 L0.45023 1.126757 L0.376189 1.160601 L0.264004 1.160601 L0.188844 1.126757 L0.113681 1.058075 L0.076661 0.954555 M0.525392 0.542467 L0.45023 0.473786 L0.376189 0.439941 L0.264004 0.439941 L0.188844 0.473786 L0.113681 0.542467 L0.076661 0.645988 L0.076661 0.714669 L0.113681 0.817193 L0.188844 0.885875 L0.264004 0.920713 L0.376189 0.920713 L0.45023 0.885875 L0.525392 0.817193",h:"M0.092041 0.240234 L0.092041 0.946817 M0.092041 0.61058 L0.205937 0.509225 L0.282214 0.476086 L0.396109 0.476086 L0.47187 0.509225 L0.510011 0.61058 L0.510011 0.946817",i:"M0.261026 0.240234 L0.341026 0.240234 M0.300978 0.476089 L0.300978 0.946817",j:"M0.3853 0.240234 L0.447023 0.240234 M0.416159 0.465708 L0.416159 1.011689 L0.383887 1.108586 L0.252832 1.140264 L0.15503 1.108586",k:"M0.065186 0.240234 L0.065186 0.946817 M0.493824 0.476086 L0.065186 0.812323 M0.236758 0.677829 L0.536867 0.946817",l:"M0.301026 0.234863 L0.301026 0.946441",m:"M0.050538 0.439941 L0.050538 0.960796 M0.050538 0.588758 L0.114405 0.476607 L0.157178 0.439941 L0.236864 0.439941 L0.279637 0.476607 L0.32241 0.588758 L0.32241 0.960796 M0.32241 0.588758 L0.386281 0.476607 L0.428467 0.439941 L0.50874 0.439941 L0.551515 0.476607 L0.551515 0.960796",n:"M0.092041 0.439941 L0.092041 0.960796 M0.092041 0.588758 L0.205936 0.476607 L0.282216 0.439941 L0.396113 0.439941 L0.471871 0.476607 L0.510011 0.588758 L0.510011 0.960796",o:"M0.247175 0.439941 L0.175178 0.477535 L0.103186 0.553823 L0.066895 0.668808 L0.066895 0.745099 L0.103186 0.858979 L0.175178 0.93527 L0.247175 0.973965 L0.354874 0.973965 L0.426872 0.93527 L0.498866 0.858979 L0.535157 0.745099 L0.535157 0.668808 L0.498866 0.553823 L0.426872 0.477535 L0.354874 0.439941 L0.247175 0.439941",p:"M0.076904 0.439941 L0.076904 1.154244 M0.076904 0.541563 L0.151986 0.473487 L0.225944 0.439941 L0.338005 0.439941 L0.413087 0.473487 L0.488166 0.541563 L0.525148 0.644169 L0.525148 0.712246 L0.488166 0.813866 L0.413087 0.881942 L0.338005 0.916471 L0.225944 0.916471 L0.151986 0.881942 L0.076904 0.813866",q:"M0.525148 0.441895 L0.525148 1.156195 M0.525148 0.5435 L0.450067 0.47544 L0.376106 0.441895 L0.264042 0.441895 L0.188966 0.47544 L0.113885 0.5435 L0.076905 0.646108 L0.076905 0.714187 L0.113885 0.815809 L0.188966 0.883886 L0.264042 0.918418 L0.376106 0.918418 L0.450067 0.883886 L0.525148 0.815809",r:"M0.107422 0.439941 L0.107422 0.960796 M0.107422 0.663164 L0.155824 0.551014 L0.252626 0.476607 L0.349428 0.439941 L0.49463 0.439941",s:"M0.475556 0.477535 L0.400757 0.439941 L0.276092 0.439941 L0.176361 0.477535 L0.101563 0.553823 L0.101563 0.630112 L0.176361 0.668808 L0.301024 0.668808 L0.425688 0.745099 L0.50049 0.821387 L0.50049 0.897677 L0.425688 0.93527 L0.325956 0.973965 L0.201295 0.973965 L0.126496 0.93527 L0.101563 0.858979",t:"M0.246032 0.297852 L0.246032 0.826549 L0.301023 0.919323 L0.411011 0.950848 L0.520997 0.950848 M0.081055 0.515799 L0.466004 0.515799",u:"M0.092041 0.454102 L0.092041 0.826134 L0.13018 0.937211 L0.205936 0.974954 L0.319832 0.974954 L0.396113 0.937211 L0.510011 0.826134 M0.510011 0.454102 L0.510011 0.974954",v:"M0.048828 0.453125 L0.301026 0.961719 M0.553224 0.453125 L0.301026 0.961719",w:"M0 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.451539 0.961719 M0.602052 0.453125 L0.451539 0.961719",x:"M0.03711 0.453125 L0.564943 0.961719 M0.564943 0.453125 L0.03711 0.961719",y:"M0.084618 0.453125 L0.320232 0.921476 M0.55713 0.453125 L0.320232 0.921476 L0.242119 1.055289 L0.163369 1.122196 L0.084618 1.155166 L0.044922 1.155166",z:"M0.505373 0.452148 L0.09668 0.961651 M0.09668 0.452148 L0.505373 0.452148 M0.09668 0.961651 L0.505373 0.961651"},lineAlphabet={};for(let letter in svgAlphabet){lineAlphabet[letter]=[];let segs=svgAlphabet[letter].split("M").slice(1).map(seg=>seg.split("L").map(pr3=>pr3.trim().split(" ").map(parseFloat)));for(let seg of segs)for(let i3=0;i3<seg.length-1;i3++)lineAlphabet[letter].push({x1:seg[i3][0],y1:1-seg[i3][1],x2:seg[i3+1][0],y2:1-seg[i3+1][1]})}}});var dist_exports3={};__export(dist_exports3,{CIRCUIT_TO_SVG_VERSION:()=>CIRCUIT_TO_SVG_VERSION,circuitJsonToPcbSvg:()=>circuitJsonToPcbSvg,circuitJsonToSchematicSvg:()=>circuitJsonToSchematicSvg,convertCircuitJsonToAssemblySvg:()=>convertCircuitJsonToAssemblySvg,convertCircuitJsonToPcbSvg:()=>convertCircuitJsonToPcbSvg,convertCircuitJsonToPinoutSvg:()=>convertCircuitJsonToPinoutSvg,convertCircuitJsonToSchematicSimulationSvg:()=>convertCircuitJsonToSchematicSimulationSvg,convertCircuitJsonToSchematicSvg:()=>convertCircuitJsonToSchematicSvg,convertCircuitJsonToSimulationGraphSvg:()=>convertCircuitJsonToSimulationGraphSvg,convertCircuitJsonToSolderPasteMask:()=>convertCircuitJsonToSolderPasteMask,createErrorTextOverlay:()=>createErrorTextOverlay,createSvgObjectsForSchComponentPortHovers:()=>createSvgObjectsForSchComponentPortHovers,getSoftwareUsedString:()=>getSoftwareUsedString,isSimulationExperiment:()=>isSimulationExperiment,isSimulationTransientVoltageGraph:()=>isSimulationTransientVoltageGraph,isSimulationVoltageProbe:()=>isSimulationVoltageProbe});function createSvgObjectsFromPcbTraceError(pcbTraceError,circuitJson,ctx){let{transform:transform6,shouldDrawErrors}=ctx;if(!shouldDrawErrors)return[];let{pcb_port_ids}=pcbTraceError,port1=circuitJson.find(el3=>el3.type==="pcb_port"&&el3.pcb_port_id===pcb_port_ids?.[0]),port2=circuitJson.find(el3=>el3.type==="pcb_port"&&el3.pcb_port_id===pcb_port_ids?.[1]);if(!port1||!port2){let viaId=pcbTraceError.message?.match(/pcb_via\[#?(pcb_via_\d+)\]/)?.[1],via=circuitJson.find(el3=>el3.type==="pcb_via"&&el3.pcb_via_id===viaId);if(via&&via.type==="pcb_via")return createSvgObjectsForViaTraceError(pcbTraceError,via,ctx);if(pcbTraceError.center){let screenCenter=applyToPoint3(transform6,{x:pcbTraceError.center.x,y:pcbTraceError.center.y});return annotateTraceErrorSvgObjects([{name:"rect",type:"element",attributes:{x:(screenCenter.x-5).toString(),y:(screenCenter.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenCenter.x} ${screenCenter.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:screenCenter.x.toString(),y:(screenCenter.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:pcbTraceError.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}])}else return[]}let screenPort1=applyToPoint3(transform6,{x:port1.x,y:port1.y}),screenPort2=applyToPoint3(transform6,{x:port2.x,y:port2.y}),errorCenter={x:(screenPort1.x+screenPort2.x)/2,y:(screenPort1.y+screenPort2.y)/2};if(isNaN(screenPort1.x)||isNaN(screenPort1.y)||isNaN(screenPort2.x)||isNaN(screenPort2.y)||isNaN(errorCenter.x)||isNaN(errorCenter.y))return[];let svgObjects=[{name:"line",type:"element",attributes:{x1:screenPort1.x.toString(),y1:screenPort1.y.toString(),x2:errorCenter.x.toString(),y2:errorCenter.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"line",type:"element",attributes:{x1:errorCenter.x.toString(),y1:errorCenter.y.toString(),x2:screenPort2.x.toString(),y2:screenPort2.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"rect",type:"element",attributes:{x:(errorCenter.x-5).toString(),y:(errorCenter.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${errorCenter.x} ${errorCenter.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:errorCenter.x.toString(),y:(errorCenter.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:pcbTraceError.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}];return annotateTraceErrorSvgObjects(svgObjects)}function createSvgObjectsForViaTraceError(pcbTraceError,via,ctx){let{transform:transform6}=ctx;if(pcbTraceError.center&&via){let screenCenter=applyToPoint3(transform6,{x:pcbTraceError.center.x,y:pcbTraceError.center.y}),screenVia=applyToPoint3(transform6,{x:via.x,y:via.y}),dx3=screenVia.x-screenCenter.x,dy3=screenVia.y-screenCenter.y,dist=Math.sqrt(dx3*dx3+dy3*dy3),angle=Math.atan2(dy3,dx3)*180/Math.PI,boxWidth=dist+10*2,boxHeight=20,midX=(screenCenter.x+screenVia.x)/2,midY=(screenCenter.y+screenVia.y)/2;return annotateTraceErrorSvgObjects([{name:"rect",type:"element",attributes:{x:(midX-boxWidth/2).toString(),y:(midY-boxHeight/2).toString(),width:boxWidth.toString(),height:boxHeight.toString(),fill:"none",stroke:"red","stroke-width":"1","stroke-dasharray":"3,2",transform:`rotate(${angle} ${midX} ${midY})`},children:[],value:""},{name:"rect",type:"element",attributes:{x:(midX-5).toString(),y:(midY-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${midX} ${midY})`},children:[],value:""},{name:"text",type:"element",attributes:{x:midX.toString(),y:(midY-boxHeight/2-5).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:pcbTraceError.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}])}return[]}function annotateTraceErrorSvgObjects(objects){return objects.map(object=>({...object,attributes:{...object.attributes??{},"data-type":object.attributes?.["data-type"]??"pcb_trace_error","data-pcb-layer":object.attributes?.["data-pcb-layer"]??"overlay"},children:(object.children??[]).map(child=>child?.type==="element"?{...child,attributes:{...child.attributes??{},"data-type":child.attributes?.["data-type"]??"pcb_trace_error","data-pcb-layer":child.attributes?.["data-pcb-layer"]??"overlay"}}:child)}))}function annotateFootprintErrorSvgObjects(objects){return objects.map(object=>({...object,attributes:{...object.attributes??{},"data-type":object.attributes?.["data-type"]??"pcb_footprint_overlap_error","data-pcb-layer":object.attributes?.["data-pcb-layer"]??"overlay"},children:(object.children??[]).map(child=>child?.type==="element"?{...child,attributes:{...child.attributes??{},"data-type":child.attributes?.["data-type"]??"pcb_footprint_overlap_error","data-pcb-layer":child.attributes?.["data-pcb-layer"]??"overlay"}}:child)}))}function createSvgObjectsFromPcbFootprintOverlapError(error2,circuitJson,ctx){let{transform:transform6,shouldDrawErrors}=ctx;if(!shouldDrawErrors)return[];let svgObjects=[],referencedElements=[],padPortIds=[];if(error2.pcb_smtpad_ids)for(let padId of error2.pcb_smtpad_ids){let pad2=circuitJson.find(el3=>el3.type==="pcb_smtpad"&&el3.pcb_smtpad_id===padId);pad2&&(referencedElements.push({x:pad2.x,y:pad2.y,type:"pcb_smtpad",id:padId,pcb_port_id:pad2.pcb_port_id}),pad2.pcb_port_id&&padPortIds.push(pad2.pcb_port_id))}let allPadsSamePort=padPortIds.length>1&&padPortIds.every(id2=>id2===padPortIds[0]),filteredReferencedElements=referencedElements;if(allPadsSamePort&&(filteredReferencedElements=referencedElements.filter(e5=>e5.type!=="pcb_smtpad")),error2.pcb_plated_hole_ids)for(let holeId of error2.pcb_plated_hole_ids){let hole=circuitJson.find(el3=>el3.type==="pcb_plated_hole"&&el3.pcb_plated_hole_id===holeId);hole&&filteredReferencedElements.push({x:hole.x,y:hole.y,type:"pcb_plated_hole",id:holeId})}if(error2.pcb_hole_ids)for(let holeId of error2.pcb_hole_ids){let hole=circuitJson.find(el3=>el3.type==="pcb_hole"&&el3.pcb_hole_id===holeId);hole&&filteredReferencedElements.push({x:hole.x,y:hole.y,type:"pcb_hole",id:holeId})}if(filteredReferencedElements.length>0){let centerX=filteredReferencedElements.reduce((sum,el3)=>sum+el3.x,0)/filteredReferencedElements.length,centerY=filteredReferencedElements.reduce((sum,el3)=>sum+el3.y,0)/filteredReferencedElements.length,screenCenter=applyToPoint3(transform6,{x:centerX,y:centerY});svgObjects.push({name:"rect",type:"element",attributes:{x:(screenCenter.x-5).toString(),y:(screenCenter.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenCenter.x} ${screenCenter.y})`},children:[],value:""}),svgObjects.push({name:"text",type:"element",attributes:{x:screenCenter.x.toString(),y:(screenCenter.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:error2.message||"PCB Footprint Overlap Error",name:"",attributes:{},children:[]}],value:""});for(let element of filteredReferencedElements){let screenPos=applyToPoint3(transform6,{x:element.x,y:element.y});svgObjects.push({name:"rect",type:"element",attributes:{x:(screenPos.x-5).toString(),y:(screenPos.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenPos.x} ${screenPos.y})`},children:[],value:""}),filteredReferencedElements.length>1&&svgObjects.push({name:"line",type:"element",attributes:{x1:screenCenter.x.toString(),y1:screenCenter.y.toString(),x2:screenPos.x.toString(),y2:screenPos.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""})}}return annotateFootprintErrorSvgObjects(svgObjects)}function createSvgObjectsFromPcbCourtyardOverlapError(error2,circuitJson,ctx){let{transform:transform6,shouldDrawErrors}=ctx;if(!shouldDrawErrors)return[];let svgObjects=[],componentCenters=[];for(let compId of error2.pcb_component_ids){let comp=circuitJson.find(el3=>el3.type==="pcb_component"&&el3.pcb_component_id===compId);comp&&componentCenters.push(comp.center)}if(componentCenters.length===0)return[];let midX=componentCenters.reduce((s3,c4)=>s3+c4.x,0)/componentCenters.length,midY=componentCenters.reduce((s3,c4)=>s3+c4.y,0)/componentCenters.length,screenMid=applyToPoint3(transform6,{x:midX,y:midY});svgObjects.push({name:"rect",type:"element",attributes:{x:(screenMid.x-5).toString(),y:(screenMid.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenMid.x} ${screenMid.y})`,"data-type":"pcb_courtyard_overlap_error","data-pcb-layer":"overlay"},children:[],value:""}),svgObjects.push({name:"text",type:"element",attributes:{x:screenMid.x.toString(),y:(screenMid.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle","data-type":"pcb_courtyard_overlap_error","data-pcb-layer":"overlay"},children:[{type:"text",value:error2.message||"PCB Courtyard Overlap",name:"",attributes:{},children:[]}],value:""});for(let center2 of componentCenters){let screenPos=applyToPoint3(transform6,center2);svgObjects.push({name:"rect",type:"element",attributes:{x:(screenPos.x-5).toString(),y:(screenPos.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenPos.x} ${screenPos.y})`,"data-type":"pcb_courtyard_overlap_error","data-pcb-layer":"overlay"},children:[],value:""})}if(componentCenters.length===2){let mapped=componentCenters.map(c4=>applyToPoint3(transform6,c4)),s12=mapped[0],s22=mapped[1];svgObjects.push({name:"line",type:"element",attributes:{x1:s12.x.toString(),y1:s12.y.toString(),x2:s22.x.toString(),y2:s22.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"4,3","data-type":"pcb_courtyard_overlap_error","data-pcb-layer":"overlay"},children:[],value:""})}return svgObjects}function annotateError(objects){return objects.map(object=>({...object,attributes:{...object.attributes??{},"data-type":object.attributes?.["data-type"]??"pcb_component_outside_board_error","data-pcb-layer":object.attributes?.["data-pcb-layer"]??"overlay"}}))}function getComponentBounds2(error2,circuitJson){let pcbComponentId=error2.pcb_component_id;if(!pcbComponentId)return error2.component_bounds??null;let pcbComponent=circuitJson.find(elm=>elm.type==="pcb_component"&&elm.pcb_component_id===pcbComponentId);return pcbComponent?.center&&pcbComponent?.width&&pcbComponent?.height?{min_x:pcbComponent.center.x-pcbComponent.width/2,max_x:pcbComponent.center.x+pcbComponent.width/2,min_y:pcbComponent.center.y-pcbComponent.height/2,max_y:pcbComponent.center.y+pcbComponent.height/2}:error2.component_bounds??null}function createSvgObjectsFromPcbComponentOutsideBoardError(error2,circuitJson,ctx){let{shouldDrawErrors,transform:transform6}=ctx;if(!shouldDrawErrors)return[];let bounds=getComponentBounds2(error2,circuitJson);if(!bounds)return[];let topLeft=applyToPoint3(transform6,{x:bounds.min_x,y:bounds.min_y}),bottomRight=applyToPoint3(transform6,{x:bounds.max_x,y:bounds.max_y}),x4=Math.min(topLeft.x,bottomRight.x),y4=Math.min(topLeft.y,bottomRight.y),width=Math.abs(bottomRight.x-topLeft.x),height=Math.abs(bottomRight.y-topLeft.y),centerX=x4+width/2,centerY=y4+height/2,svgObjects=[{type:"element",name:"rect",value:"",attributes:{x:x4.toString(),y:y4.toString(),width:width.toString(),height:height.toString(),fill:"none",stroke:"red","stroke-width":"1.5","stroke-dasharray":"4,2"},children:[]},{type:"element",name:"rect",value:"",attributes:{x:(centerX-5).toString(),y:(centerY-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${centerX} ${centerY})`},children:[]},{type:"element",name:"text",value:"",attributes:{x:centerX.toString(),y:(y4-10).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",name:"",value:error2.message??"PCB component extends outside board boundaries",attributes:{},children:[]}]}];return annotateError(svgObjects)}function annotateError2(objects){return objects.map(object=>({...object,attributes:{...object.attributes??{},"data-type":object.attributes?.["data-type"]??"pcb_via_trace_clearance_error","data-pcb-layer":object.attributes?.["data-pcb-layer"]??"overlay"}}))}function createSvgObjectsFromPcbViaTraceClearanceError(error2,_circuitJson,ctx){let{shouldDrawErrors,transform:transform6}=ctx;if(!shouldDrawErrors)return[];let center2=error2.center;if(!center2||typeof center2.x!="number"||typeof center2.y!="number")return[];let screenCenter=applyToPoint3(transform6,center2),actualClearance=error2.actual_clearance,minimumClearance=error2.minimum_clearance,defaultMessage=actualClearance&&minimumClearance?`Via/trace clearance ${actualClearance} is below minimum ${minimumClearance}`:"Via and trace too close",message=error2.message??defaultMessage,svgObjects=[{type:"element",name:"rect",value:"",attributes:{x:(screenCenter.x-5).toString(),y:(screenCenter.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${screenCenter.x} ${screenCenter.y})`},children:[]},{type:"element",name:"text",value:"",attributes:{x:screenCenter.x.toString(),y:(screenCenter.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",name:"",value:message,attributes:{},children:[]}]}];return annotateError2(svgObjects)}function createSvgObjectsFromPcbFabricationNotePath(fabNotePath,ctx){let{transform:transform6,layer:layerFilter}=ctx;if(!fabNotePath.route||!Array.isArray(fabNotePath.route))return[];let firstPoint=fabNotePath.route[0],lastPoint=fabNotePath.route[fabNotePath.route.length-1],isClosed=firstPoint.x===lastPoint.x&&firstPoint.y===lastPoint.y,path=fabNotePath.route.slice(0,isClosed?-1:void 0).map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ")+(isClosed?" Z":"");return[{name:"path",type:"element",attributes:{class:"pcb-fabrication-note-path",stroke:fabNotePath.color||"rgba(255,255,255,0.5)",fill:"none",d:path,"stroke-width":(fabNotePath.stroke_width*Math.abs(transform6.a)).toString(),"data-pcb-component-id":fabNotePath.pcb_component_id,"data-pcb-fabrication-note-path-id":fabNotePath.pcb_fabrication_note_path_id,"data-type":"pcb_fabrication_note_path","data-pcb-layer":"overlay"},value:"",children:[]}]}function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText,ctx){let{transform:transform6,layer:layerFilter}=ctx,{anchor_position,anchor_alignment="center",text,font_size=1,layer="top",color}=pcbFabNoteText;if(layerFilter&&layer!==layerFilter)return[];if(!anchor_position||typeof anchor_position.x!="number"||typeof anchor_position.y!="number")return debugPcb(`[pcb_fabrication_note_text] Invalid anchor_position for "${pcbFabNoteText.pcb_fabrication_note_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[anchor_position.x,anchor_position.y]),transformedFontSize=font_size*Math.abs(transform6.a),textAnchor="middle",dominantBaseline="central";switch(anchor_alignment){case"top_left":textAnchor="start",dominantBaseline="text-before-edge";break;case"top_right":textAnchor="end",dominantBaseline="text-before-edge";break;case"bottom_left":textAnchor="start",dominantBaseline="text-after-edge";break;case"bottom_right":textAnchor="end",dominantBaseline="text-after-edge";break}let textTransform=compose3(translate3(transformedX,transformedY),rotate3(Math.PI/180));return[{name:"text",type:"element",attributes:{x:"0",y:"0","font-family":"Arial, sans-serif","font-size":transformedFontSize.toString(),"text-anchor":textAnchor,"dominant-baseline":dominantBaseline,transform:toString2(textTransform),class:"pcb-fabrication-note-text",fill:color||"rgba(255,255,255,0.5)","data-type":"pcb_fabrication_note_text","data-pcb-layer":"overlay"},children:[{type:"text",value:text,name:"",attributes:{},children:[]}],value:""}]}function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect,ctx){let{transform:transform6,layer:layerFilter}=ctx,{center:center2,width,height,stroke_width,is_filled,has_stroke,is_stroke_dashed,color,layer="top",pcb_component_id,pcb_fabrication_note_rect_id,corner_radius}=fabricationNoteRect;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof width!="number"||typeof height!="number")return debugPcb(`[pcb_fabrication_note_rect] Invalid data for "${pcb_fabrication_note_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center2)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`),[];let halfWidth=width/2,halfHeight=height/2,[topLeftX,topLeftY]=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]),[bottomRightX,bottomRightY]=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),rectX=Math.min(topLeftX,bottomRightX),rectY=Math.min(topLeftY,bottomRightY),rectWidth=Math.abs(bottomRightX-topLeftX),rectHeight=Math.abs(bottomRightY-topLeftY),transformedStrokeWidth=(typeof stroke_width=="number"?stroke_width:0)*Math.abs(transform6.a),overlayStrokeColor=color??DEFAULT_OVERLAY_STROKE_COLOR,baseCornerRadius=typeof corner_radius=="number"&&corner_radius>0?corner_radius:0,transformedCornerRadiusX=baseCornerRadius*Math.abs(transform6.a),transformedCornerRadiusY=baseCornerRadius*Math.abs(transform6.d),attributes2={x:rectX.toString(),y:rectY.toString(),width:rectWidth.toString(),height:rectHeight.toString(),class:"pcb-fabrication-note-rect","data-type":"pcb_fabrication_note_rect","data-pcb-fabrication-note-rect-id":pcb_fabrication_note_rect_id,"data-pcb-layer":"overlay"};if(pcb_component_id!==void 0&&(attributes2["data-pcb-component-id"]=pcb_component_id),transformedCornerRadiusX>0&&(attributes2.rx=transformedCornerRadiusX.toString()),transformedCornerRadiusY>0&&(attributes2.ry=transformedCornerRadiusY.toString()),is_filled?attributes2.fill=color??DEFAULT_OVERLAY_FILL_COLOR:attributes2.fill="none",has_stroke??transformedStrokeWidth>0){if(attributes2.stroke=overlayStrokeColor,attributes2["stroke-width"]=transformedStrokeWidth.toString(),is_stroke_dashed){let dash=.2*Math.abs(transform6.a),gap=.1*Math.abs(transform6.a);attributes2["stroke-dasharray"]=`${dash} ${gap}`}}else attributes2.stroke="none";return[{name:"rect",type:"element",value:"",attributes:attributes2,children:[]}]}function normalize(vector2){let length4=Math.hypot(vector2.x,vector2.y)||1;return{x:vector2.x/length4,y:vector2.y/length4}}function toPath(points){return points.map((point7,index)=>index===0?`M ${point7.x} ${point7.y}`:`L ${point7.x} ${point7.y}`).join(" ")}function createSvgObjectsFromPcbFabricationNoteDimension(dimension,ctx){let{transform:transform6,layer:layerFilter}=ctx,{from,to:to3,text,font_size=1,color,arrow_size,layer,pcb_component_id,pcb_fabrication_note_dimension_id,offset_distance,offset_direction,text_ccw_rotation}=dimension;if(layerFilter&&layer&&layer!==layerFilter)return[];if(!from||!to3||typeof from!="object"||typeof to3!="object")return debugPcb(`[pcb_fabrication_note_dimension] Invalid endpoints for "${pcb_fabrication_note_dimension_id}": expected {from: {x, y}, to: {x, y}}, got from=${JSON.stringify(from)}, to=${JSON.stringify(to3)}`),[];if(typeof from.x!="number"||typeof from.y!="number"||typeof to3.x!="number"||typeof to3.y!="number")return debugPcb(`[pcb_fabrication_note_dimension] Invalid point values for "${pcb_fabrication_note_dimension_id}": x and y must be numbers, got from=${JSON.stringify(from)}, to=${JSON.stringify(to3)}`),[];let numericArrowSize=typeof arrow_size=="number"?arrow_size:void 0;if(numericArrowSize===void 0||!Number.isFinite(numericArrowSize)||numericArrowSize<=0)return debugPcb(`[pcb_fabrication_note_dimension] Invalid arrow_size for "${pcb_fabrication_note_dimension_id}": expected positive number, got ${JSON.stringify(arrow_size)}`),[];let arrowSize=numericArrowSize,direction2=normalize({x:to3.x-from.x,y:to3.y-from.y});if(Number.isNaN(direction2.x)||Number.isNaN(direction2.y))return[];let perpendicular={x:-direction2.y,y:direction2.x},hasOffsetDirection=offset_direction&&typeof offset_direction.x=="number"&&typeof offset_direction.y=="number",normalizedOffsetDirection=hasOffsetDirection?normalize({x:offset_direction.x,y:offset_direction.y}):{x:0,y:0},offsetMagnitude=typeof offset_distance=="number"?offset_distance:0,offsetVector={x:normalizedOffsetDirection.x*offsetMagnitude,y:normalizedOffsetDirection.y*offsetMagnitude},applyOffset=point7=>({x:point7.x+offsetVector.x,y:point7.y+offsetVector.y}),fromOffset=applyOffset(from),toOffset=applyOffset(to3),arrowHalfWidth=arrowSize/2,fromBase={x:fromOffset.x+direction2.x*arrowSize,y:fromOffset.y+direction2.y*arrowSize},toBase={x:toOffset.x-direction2.x*arrowSize,y:toOffset.y-direction2.y*arrowSize},fromTriangle=[toScreen(fromOffset),toScreen({x:fromBase.x+perpendicular.x*arrowHalfWidth,y:fromBase.y+perpendicular.y*arrowHalfWidth}),toScreen({x:fromBase.x-perpendicular.x*arrowHalfWidth,y:fromBase.y-perpendicular.y*arrowHalfWidth})],toTriangle=[toScreen(toOffset),toScreen({x:toBase.x+perpendicular.x*arrowHalfWidth,y:toBase.y+perpendicular.y*arrowHalfWidth}),toScreen({x:toBase.x-perpendicular.x*arrowHalfWidth,y:toBase.y-perpendicular.y*arrowHalfWidth})],[lineStartX,lineStartY]=applyToPoint3(transform6,[fromBase.x,fromBase.y]),[lineEndX,lineEndY]=applyToPoint3(transform6,[toBase.x,toBase.y]),strokeWidth=arrowSize/5*Math.abs(transform6.a),lineColor=color||"rgba(255,255,255,0.5)",extensionDirection=hasOffsetDirection&&(Math.abs(normalizedOffsetDirection.x)>Number.EPSILON||Math.abs(normalizedOffsetDirection.y)>Number.EPSILON)?normalizedOffsetDirection:perpendicular,extensionLength=offsetMagnitude+arrowSize,createExtensionLine=anchor=>{let endPoint={x:anchor.x+extensionDirection.x*extensionLength,y:anchor.y+extensionDirection.y*extensionLength},[startX,startY]=applyToPoint3(transform6,[anchor.x,anchor.y]),[endX,endY]=applyToPoint3(transform6,[endPoint.x,endPoint.y]);return{name:"path",type:"element",value:"",attributes:{d:`M ${startX} ${startY} L ${endX} ${endY}`,stroke:lineColor,fill:"none","stroke-width":strokeWidth.toString(),"stroke-linecap":"round",class:"pcb-fabrication-note-dimension-extension"},children:[]}},extensionSegments=[createExtensionLine(from),createExtensionLine(to3)],midPoint2={x:(from.x+to3.x)/2+offsetVector.x,y:(from.y+to3.y)/2+offsetVector.y},[screenFromX,screenFromY]=applyToPoint3(transform6,[fromOffset.x,fromOffset.y]),[screenToX,screenToY]=applyToPoint3(transform6,[toOffset.x,toOffset.y]),screenDirection=normalize({x:screenToX-screenFromX,y:screenToY-screenFromY}),textAngle=Math.atan2(screenDirection.y,screenDirection.x)*180/Math.PI;(textAngle>90||textAngle<-90)&&(textAngle+=180);let finalTextAngle=typeof text_ccw_rotation=="number"&&Number.isFinite(text_ccw_rotation)?textAngle-text_ccw_rotation:textAngle,additionalOffset=0;if(text&&typeof text_ccw_rotation=="number"&&Number.isFinite(text_ccw_rotation)){let textWidth=text.length*font_size*CHARACTER_WIDTH_MULTIPLIER,textHeight=font_size,rotationRad=text_ccw_rotation*Math.PI/180,sinRot=Math.abs(Math.sin(rotationRad)),cosRot=Math.abs(Math.cos(rotationRad)),halfWidth=textWidth/2,halfHeight=textHeight/2;additionalOffset=halfWidth*sinRot+halfHeight*cosRot+font_size*TEXT_INTERSECTION_PADDING_MULTIPLIER}let textOffset=arrowSize*TEXT_OFFSET_MULTIPLIER+additionalOffset,textPoint={x:midPoint2.x+perpendicular.x*textOffset,y:midPoint2.y+perpendicular.y*textOffset},[textX,textY]=applyToPoint3(transform6,[textPoint.x,textPoint.y]),transformedFontSize=font_size*Math.abs(transform6.a),children=[...extensionSegments,{name:"path",type:"element",value:"",attributes:{d:`M ${lineStartX} ${lineStartY} L ${lineEndX} ${lineEndY}`,stroke:lineColor,fill:"none","stroke-width":strokeWidth.toString(),"stroke-linecap":"round",class:"pcb-fabrication-note-dimension-line"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${toPath(fromTriangle)} Z`,fill:lineColor,class:"pcb-fabrication-note-dimension-arrow"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${toPath(toTriangle)} Z`,fill:lineColor,class:"pcb-fabrication-note-dimension-arrow"},children:[]}];text&&children.push({name:"text",type:"element",value:"",attributes:{x:textX.toString(),y:textY.toString(),fill:lineColor,"font-size":transformedFontSize.toString(),"font-family":"Arial, sans-serif","text-anchor":"middle","dominant-baseline":"central",class:"pcb-fabrication-note-dimension-text",transform:`rotate(${finalTextAngle} ${textX} ${textY})`},children:[{type:"text",name:"",value:text,attributes:{},children:[]}]});let attributes2={class:"pcb-fabrication-note-dimension","data-type":"pcb_fabrication_note_dimension","data-pcb-fabrication-note-dimension-id":pcb_fabrication_note_dimension_id,"data-pcb-layer":layer??"overlay"};return pcb_component_id!==void 0&&(attributes2["data-pcb-component-id"]=pcb_component_id),[{name:"g",type:"element",value:"",attributes:attributes2,children}];function toScreen(point7){let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return{x:x4,y:y4}}}function normalize2(vector2){let length4=Math.hypot(vector2.x,vector2.y)||1;return{x:vector2.x/length4,y:vector2.y/length4}}function toPath2(points){return points.map((point7,index)=>index===0?`M ${point7.x} ${point7.y}`:`L ${point7.x} ${point7.y}`).join(" ")}function createSvgObjectsFromPcbNoteDimension(dimension,ctx){let{transform:transform6}=ctx,{from,to:to3,text,font_size=1,color,arrow_size,offset_distance,offset_direction,text_ccw_rotation}=dimension;if(!from||!to3)return debugPcb(`[pcb_note_dimension] Invalid endpoints for "${dimension.pcb_note_dimension_id}": expected {from: {x, y}, to: {x, y}}, got from=${JSON.stringify(from)}, to=${JSON.stringify(to3)}`),[];if(!Number.isFinite(arrow_size)||arrow_size<=0)return debugPcb(`[pcb_note_dimension] Invalid arrow_size for "${dimension.pcb_note_dimension_id}": expected positive number, got ${JSON.stringify(arrow_size)}`),[];let direction2=normalize2({x:to3.x-from.x,y:to3.y-from.y});if(Number.isNaN(direction2.x)||Number.isNaN(direction2.y))return[];let perpendicular={x:-direction2.y,y:direction2.x},hasOffsetDirection=offset_direction&&typeof offset_direction.x=="number"&&typeof offset_direction.y=="number",normalizedOffsetDirection=hasOffsetDirection?normalize2({x:offset_direction.x,y:offset_direction.y}):{x:0,y:0},offsetMagnitude=typeof offset_distance=="number"?offset_distance:0,offsetVector={x:normalizedOffsetDirection.x*offsetMagnitude,y:normalizedOffsetDirection.y*offsetMagnitude},applyOffset=point7=>({x:point7.x+offsetVector.x,y:point7.y+offsetVector.y}),fromOffset=applyOffset(from),toOffset=applyOffset(to3),arrowHalfWidth=arrow_size/2,fromBase={x:fromOffset.x+direction2.x*arrow_size,y:fromOffset.y+direction2.y*arrow_size},toBase={x:toOffset.x-direction2.x*arrow_size,y:toOffset.y-direction2.y*arrow_size},fromTriangle=[toScreen(fromOffset),toScreen({x:fromBase.x+perpendicular.x*arrowHalfWidth,y:fromBase.y+perpendicular.y*arrowHalfWidth}),toScreen({x:fromBase.x-perpendicular.x*arrowHalfWidth,y:fromBase.y-perpendicular.y*arrowHalfWidth})],toTriangle=[toScreen(toOffset),toScreen({x:toBase.x+perpendicular.x*arrowHalfWidth,y:toBase.y+perpendicular.y*arrowHalfWidth}),toScreen({x:toBase.x-perpendicular.x*arrowHalfWidth,y:toBase.y-perpendicular.y*arrowHalfWidth})],[lineStartX,lineStartY]=applyToPoint3(transform6,[fromBase.x,fromBase.y]),[lineEndX,lineEndY]=applyToPoint3(transform6,[toBase.x,toBase.y]),strokeWidth=arrow_size/5*Math.abs(transform6.a),lineColor=color||colorMap.board.user_2,extensionDirection=hasOffsetDirection&&(Math.abs(normalizedOffsetDirection.x)>Number.EPSILON||Math.abs(normalizedOffsetDirection.y)>Number.EPSILON)?normalizedOffsetDirection:perpendicular,extensionLength=offsetMagnitude+arrow_size,createExtensionLine=anchor=>{let endPoint={x:anchor.x+extensionDirection.x*extensionLength,y:anchor.y+extensionDirection.y*extensionLength},[startX,startY]=applyToPoint3(transform6,[anchor.x,anchor.y]),[endX,endY]=applyToPoint3(transform6,[endPoint.x,endPoint.y]);return{name:"path",type:"element",value:"",attributes:{d:`M ${startX} ${startY} L ${endX} ${endY}`,stroke:lineColor,fill:"none","stroke-width":strokeWidth.toString(),"stroke-linecap":"round",class:"pcb-note-dimension-extension"},children:[]}},extensionSegments=[createExtensionLine(from),createExtensionLine(to3)],midPoint2={x:(from.x+to3.x)/2+offsetVector.x,y:(from.y+to3.y)/2+offsetVector.y},[screenFromX,screenFromY]=applyToPoint3(transform6,[fromOffset.x,fromOffset.y]),[screenToX,screenToY]=applyToPoint3(transform6,[toOffset.x,toOffset.y]),screenDirection=normalize2({x:screenToX-screenFromX,y:screenToY-screenFromY}),textAngle=Math.atan2(screenDirection.y,screenDirection.x)*180/Math.PI;(textAngle>90||textAngle<-90)&&(textAngle+=180);let finalTextAngle=typeof text_ccw_rotation=="number"&&Number.isFinite(text_ccw_rotation)?textAngle-text_ccw_rotation:textAngle,additionalOffset=0;if(text&&typeof text_ccw_rotation=="number"&&Number.isFinite(text_ccw_rotation)){let textWidth=text.length*font_size*.6,textHeight=font_size,rotationRad=text_ccw_rotation*Math.PI/180,sinRot=Math.abs(Math.sin(rotationRad)),cosRot=Math.abs(Math.cos(rotationRad)),halfWidth=textWidth/2,halfHeight=textHeight/2;additionalOffset=halfWidth*sinRot+halfHeight*cosRot+font_size*.3}let textOffset=arrow_size*1.5+additionalOffset,textPoint={x:midPoint2.x+perpendicular.x*textOffset,y:midPoint2.y+perpendicular.y*textOffset},[textX,textY]=applyToPoint3(transform6,[textPoint.x,textPoint.y]),transformedFontSize=font_size*Math.abs(transform6.a),children=[...extensionSegments,{name:"path",type:"element",value:"",attributes:{d:`M ${lineStartX} ${lineStartY} L ${lineEndX} ${lineEndY}`,stroke:lineColor,fill:"none","stroke-width":strokeWidth.toString(),"stroke-linecap":"round",class:"pcb-note-dimension-line"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${toPath2(fromTriangle)} Z`,fill:lineColor,class:"pcb-note-dimension-arrow"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${toPath2(toTriangle)} Z`,fill:lineColor,class:"pcb-note-dimension-arrow"},children:[]}];return text&&children.push({name:"text",type:"element",value:"",attributes:{x:textX.toString(),y:textY.toString(),fill:lineColor,"font-size":transformedFontSize.toString(),"font-family":"Arial, sans-serif","text-anchor":"middle","dominant-baseline":"central",class:"pcb-note-dimension-text",transform:`rotate(${finalTextAngle} ${textX} ${textY})`},children:[{type:"text",name:"",value:text,attributes:{},children:[]}]}),[{name:"g",type:"element",value:"",attributes:{class:"pcb-note-dimension","data-type":"pcb_note_dimension","data-pcb-note-dimension-id":dimension.pcb_note_dimension_id,"data-pcb-layer":"overlay"},children}];function toScreen(point7){let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return{x:x4,y:y4}}}function createSvgObjectsFromPcbNoteText(note,ctx){let{transform:transform6}=ctx,{anchor_position,text,font_size=1,anchor_alignment="center",color}=note;if(!anchor_position||typeof anchor_position.x!="number"||typeof anchor_position.y!="number")return debugPcb(`[pcb_note_text] Invalid anchor_position for "${note.pcb_note_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`),[];if(typeof text!="string"||text.length===0)return debugPcb(`[pcb_note_text] Invalid text for "${note.pcb_note_text_id}": expected non-empty string, got ${JSON.stringify(text)}`),[];let[x4,y4]=applyToPoint3(transform6,[anchor_position.x,anchor_position.y]),transformedFontSize=font_size*Math.abs(transform6.a),textAnchor="middle",dominantBaseline="central";switch(anchor_alignment){case"top_left":textAnchor="start",dominantBaseline="text-before-edge";break;case"top_right":textAnchor="end",dominantBaseline="text-before-edge";break;case"bottom_left":textAnchor="start",dominantBaseline="text-after-edge";break;case"bottom_right":textAnchor="end",dominantBaseline="text-after-edge";break;default:textAnchor="middle",dominantBaseline="central";break}let lines=text.split(`
|
|
226
226
|
`),children=lines.length===1?[{type:"text",name:"",value:text,attributes:{},children:[]}]:lines.map((line2,index)=>({type:"element",name:"tspan",value:"",attributes:{x:x4.toString(),...index>0?{dy:"1em"}:{}},children:[{type:"text",name:"",value:line2,attributes:{},children:[]}]}));return[{name:"text",type:"element",value:"",attributes:{x:x4.toString(),y:y4.toString(),fill:color??DEFAULT_OVERLAY_COLOR,"font-family":"Arial, sans-serif","font-size":transformedFontSize.toString(),"text-anchor":textAnchor,"dominant-baseline":dominantBaseline,class:"pcb-note-text","data-type":"pcb_note_text","data-pcb-note-text-id":note.pcb_note_text_id,"data-pcb-layer":"overlay"},children}]}function createSvgObjectsFromPcbNoteRect(noteRect,ctx){let{transform:transform6}=ctx,{center:center2,width,height,stroke_width,is_filled,has_stroke,is_stroke_dashed,color,corner_radius}=noteRect;if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof width!="number"||typeof height!="number")return debugPcb(`[pcb_note_rect] Invalid data for "${noteRect.pcb_note_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center2)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`),[];let halfWidth=width/2,halfHeight=height/2,[topLeftX,topLeftY]=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]),[bottomRightX,bottomRightY]=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),rectX=Math.min(topLeftX,bottomRightX),rectY=Math.min(topLeftY,bottomRightY),rectWidth=Math.abs(bottomRightX-topLeftX),rectHeight=Math.abs(bottomRightY-topLeftY),transformedStrokeWidth=(typeof stroke_width=="number"?stroke_width:0)*Math.abs(transform6.a),baseCornerRadius=typeof corner_radius=="number"&&corner_radius>0?corner_radius:0,transformedCornerRadiusX=baseCornerRadius*Math.abs(transform6.a),transformedCornerRadiusY=baseCornerRadius*Math.abs(transform6.d),overlayColor=color??DEFAULT_OVERLAY_COLOR2,attributes2={x:rectX.toString(),y:rectY.toString(),width:rectWidth.toString(),height:rectHeight.toString(),class:"pcb-note-rect","data-type":"pcb_note_rect","data-pcb-note-rect-id":noteRect.pcb_note_rect_id,"data-pcb-layer":"overlay"};if(transformedCornerRadiusX>0&&(attributes2.rx=transformedCornerRadiusX.toString()),transformedCornerRadiusY>0&&(attributes2.ry=transformedCornerRadiusY.toString()),is_filled?attributes2.fill=color??DEFAULT_FILL_COLOR:attributes2.fill="none",has_stroke??transformedStrokeWidth>0){if(attributes2.stroke=overlayColor,attributes2["stroke-width"]=transformedStrokeWidth.toString(),is_stroke_dashed){let dash=.2*Math.abs(transform6.a),gap=.1*Math.abs(transform6.a);attributes2["stroke-dasharray"]=`${dash} ${gap}`}}else attributes2.stroke="none";return[{name:"rect",type:"element",value:"",attributes:attributes2,children:[]}]}function createSvgObjectsFromPcbNotePath(notePath,ctx){let{transform:transform6}=ctx;if(!Array.isArray(notePath.route)||notePath.route.length===0)return debugPcb(`[pcb_note_path] Invalid route for "${notePath.pcb_note_path_id}": expected non-empty array of points, got ${JSON.stringify(notePath.route)}`),[];for(let point7 of notePath.route)if(typeof point7.x!="number"||typeof point7.y!="number")return debugPcb(`[pcb_note_path] Invalid point in route for "${notePath.pcb_note_path_id}": expected {x: number, y: number}, got ${JSON.stringify(point7)}`),[];let pathD=notePath.route.map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" "),strokeWidth=notePath.stroke_width*Math.abs(transform6.a);return[{name:"path",type:"element",value:"",attributes:{d:pathD,stroke:notePath.color??DEFAULT_OVERLAY_COLOR3,fill:"none","stroke-width":strokeWidth.toString(),class:"pcb-note-path","data-type":"pcb_note_path","data-pcb-note-path-id":notePath.pcb_note_path_id,"data-pcb-layer":"overlay"},children:[]}]}function createSvgObjectsFromPcbNoteLine(noteLine,ctx){let{transform:transform6}=ctx,{x1:x12,y1:y12,x2:x22,y2:y22,stroke_width,color,is_dashed}=noteLine;if(typeof x12!="number"||typeof y12!="number"||typeof x22!="number"||typeof y22!="number")return debugPcb(`[pcb_note_line] Invalid coordinates for "${noteLine.pcb_note_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`),[];let[startX,startY]=applyToPoint3(transform6,[x12,y12]),[endX,endY]=applyToPoint3(transform6,[x22,y22]),transformedStrokeWidth=(typeof stroke_width=="number"?stroke_width:0)*Math.abs(transform6.a),attributes2={x1:startX.toString(),y1:startY.toString(),x2:endX.toString(),y2:endY.toString(),stroke:color??DEFAULT_OVERLAY_COLOR4,"stroke-width":transformedStrokeWidth.toString(),"stroke-linecap":"round",class:"pcb-note-line","data-type":"pcb_note_line","data-pcb-note-line-id":noteLine.pcb_note_line_id,"data-pcb-layer":"overlay"};if(is_dashed){let dash=.2*Math.abs(transform6.a),gap=.1*Math.abs(transform6.a);attributes2["stroke-dasharray"]=`${dash} ${gap}`}return[{name:"line",type:"element",value:"",attributes:attributes2,children:[]}]}function createSvgObjectsFromPcbPlatedHole(hole,ctx){let{transform:transform6,colorMap:colorMap2,showSolderMask}=ctx,[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]),layer=Array.isArray(hole.layers)&&hole.layers[0]||hole.layer||"top",maskLayer=layer,isCoveredWithSolderMask=!!hole.is_covered_with_solder_mask,soldermaskMargin=(hole.soldermask_margin??0)*Math.abs(transform6.a),shouldShowSolderMask=showSolderMask&&isCoveredWithSolderMask&&soldermaskMargin!==0,solderMaskColor=colorMap2.soldermaskWithCopperUnderneath.top;if(hole.shape==="pill"){let scaledOuterWidth=hole.outer_width*Math.abs(transform6.a),scaledOuterHeight=hole.outer_height*Math.abs(transform6.a),scaledHoleWidth=hole.hole_width*Math.abs(transform6.a),scaledHoleHeight=hole.hole_height*Math.abs(transform6.a),rotation5=hole.ccw_rotation||0,outerTransform=rotation5?`translate(${x4} ${y4}) rotate(${-rotation5})`:`translate(${x4} ${y4})`,innerTransform=rotation5?`translate(${x4} ${y4}) rotate(${-rotation5})`:`translate(${x4} ${y4})`,createPillPath=(width,height)=>{if(width>height){let radius=height/2,straightLength=width-2*radius;return`M${-width/2+radius},${-radius} h${straightLength} a${radius},${radius} 0 0 1 0,${height} h${-straightLength} a${radius},${radius} 0 0 1 0,${-height} z`}else if(height>width){let radius=width/2,straightLength=height-2*radius;return`M${radius},${-height/2+radius} v${straightLength} a${radius},${radius} 0 0 1 ${-width},0 v${-straightLength} a${radius},${radius} 0 0 1 ${width},0 z`}else{let radius=width/2;return`M${-radius},0 a${radius},${radius} 0 0 1 ${width},0 a${radius},${radius} 0 0 1 ${-width},0 z`}},children=[{name:"path",type:"element",attributes:{class:"pcb-hole-outer",fill:colorMap2.copper.top,d:createPillPath(scaledOuterWidth,scaledOuterHeight),transform:outerTransform,"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"path",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,d:createPillPath(scaledHoleWidth,scaledHoleHeight),transform:innerTransform,"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}];if(shouldShowSolderMask){let maskWidth=scaledOuterWidth+2*soldermaskMargin,maskHeight=scaledOuterHeight+2*soldermaskMargin;soldermaskMargin<0?children=[{name:"path",type:"element",attributes:{class:"pcb-hole-outer-covered",fill:solderMaskColor,d:createPillPath(scaledOuterWidth,scaledOuterHeight),transform:outerTransform,"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"path",type:"element",attributes:{class:"pcb-hole-outer-exposed",fill:colorMap2.copper.top,d:createPillPath(maskWidth,maskHeight),transform:outerTransform,"data-type":"pcb_soldermask","data-pcb-layer":maskLayer},value:"",children:[]},children[1]]:children.unshift({name:"path",type:"element",attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,d:createPillPath(maskWidth,maskHeight),transform:outerTransform,"data-type":"pcb_soldermask_opening","data-pcb-layer":maskLayer},value:"",children:[]})}return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children,value:""}]}if(hole.shape==="oval"){let scaledOuterWidth=hole.outer_width*Math.abs(transform6.a),scaledOuterHeight=hole.outer_height*Math.abs(transform6.a),scaledHoleWidth=hole.hole_width*Math.abs(transform6.a),scaledHoleHeight=hole.hole_height*Math.abs(transform6.a),rotation5=hole.ccw_rotation||0,transformStr=rotation5?`translate(${x4} ${y4}) rotate(${-rotation5})`:`translate(${x4} ${y4})`,children=[{name:"ellipse",type:"element",attributes:{class:"pcb-hole-outer",fill:colorMap2.copper.top,cx:"0",cy:"0",rx:(scaledOuterWidth/2).toString(),ry:(scaledOuterHeight/2).toString(),transform:transformStr,"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"ellipse",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,cx:"0",cy:"0",rx:(scaledHoleWidth/2).toString(),ry:(scaledHoleHeight/2).toString(),transform:transformStr,"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}];return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children,value:""}]}if(hole.shape==="circle"){let scaledOuterWidth=hole.outer_diameter*Math.abs(transform6.a),scaledOuterHeight=hole.outer_diameter*Math.abs(transform6.a),scaledHoleWidth=hole.hole_diameter*Math.abs(transform6.a),scaledHoleHeight=hole.hole_diameter*Math.abs(transform6.a),outerRadius=Math.min(scaledOuterWidth,scaledOuterHeight)/2,innerRadius=Math.min(scaledHoleWidth,scaledHoleHeight)/2,children=[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:colorMap2.copper.top,cx:x4.toString(),cy:y4.toString(),r:outerRadius.toString(),"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,cx:x4.toString(),cy:y4.toString(),r:innerRadius.toString(),"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}];if(shouldShowSolderMask){let maskRadius=outerRadius+soldermaskMargin;soldermaskMargin<0?children=[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer-covered",fill:solderMaskColor,cx:x4.toString(),cy:y4.toString(),r:outerRadius.toString(),"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-outer-exposed",fill:colorMap2.copper.top,cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask","data-pcb-layer":maskLayer},value:"",children:[]},children[1]]:children.unshift({name:"circle",type:"element",attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":maskLayer},value:"",children:[]})}return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children,value:""}]}if(hole.shape==="circular_hole_with_rect_pad"){let h6=hole,scaledHoleDiameter=hole.hole_diameter*Math.abs(transform6.a),scaledRectPadWidth=hole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=hole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(hole.rect_border_radius??0)*Math.abs(transform6.a),rectCcwRotation=hole.rect_ccw_rotation??0,rotation5=h6.rect_ccw_rotation??0,rectTransform=rotation5?`translate(${x4} ${y4}) rotate(${-rotation5})`:void 0,xStr=rotation5?(-scaledRectPadWidth/2).toString():(x4-scaledRectPadWidth/2).toString(),yStr=rotation5?(-scaledRectPadHeight/2).toString():(y4-scaledRectPadHeight/2).toString(),holeRadius=scaledHoleDiameter/2,[holeCx,holeCy]=applyToPoint3(transform6,[h6.x+(h6.hole_offset_x??0),h6.y+(h6.hole_offset_y??0)]),children=[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:colorMap2.copper.top,...rectCcwRotation?{x:(-scaledRectPadWidth/2).toString(),y:(-scaledRectPadHeight/2).toString(),transform:`translate(${x4} ${y4}) rotate(${-rectCcwRotation})`}:{x:(x4-scaledRectPadWidth/2).toString(),y:(y4-scaledRectPadHeight/2).toString()},width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),...rectTransform?{transform:rectTransform}:{},...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,cx:holeCx.toString(),cy:holeCy.toString(),r:holeRadius.toString(),"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}];if(shouldShowSolderMask){let maskWidth=scaledRectPadWidth+2*soldermaskMargin,maskHeight=scaledRectPadHeight+2*soldermaskMargin,maskBorderRadius=scaledRectBorderRadius+soldermaskMargin;soldermaskMargin<0?children=[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-covered",fill:solderMaskColor,...rectCcwRotation?{x:(-scaledRectPadWidth/2).toString(),y:(-scaledRectPadHeight/2).toString(),transform:`translate(${x4} ${y4}) rotate(${-rectCcwRotation})`}:{x:(x4-scaledRectPadWidth/2).toString(),y:(y4-scaledRectPadHeight/2).toString()},width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),...rectTransform?{transform:rectTransform}:{},...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-exposed",fill:colorMap2.copper.top,...rectCcwRotation?{x:(-maskWidth/2).toString(),y:(-maskHeight/2).toString(),transform:`translate(${x4} ${y4}) rotate(${-rectCcwRotation})`}:{x:(x4-maskWidth/2).toString(),y:(y4-maskHeight/2).toString()},width:maskWidth.toString(),height:maskHeight.toString(),...rectTransform?{transform:rectTransform}:{},...maskBorderRadius>0?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{},"data-type":"pcb_soldermask","data-pcb-layer":maskLayer},value:"",children:[]},children[1]]:children.unshift({name:"rect",type:"element",attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,...rectCcwRotation?{x:(-maskWidth/2).toString(),y:(-maskHeight/2).toString(),transform:`translate(${x4} ${y4}) rotate(${-rectCcwRotation})`}:{x:(x4-maskWidth/2).toString(),y:(y4-maskHeight/2).toString()},width:maskWidth.toString(),height:maskHeight.toString(),...rectTransform?{transform:rectTransform}:{},...scaledRectBorderRadius?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{},"data-type":"pcb_soldermask_opening","data-pcb-layer":maskLayer},value:"",children:[]})}return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children,value:""}]}if(hole.shape==="pill_hole_with_rect_pad"){let pillHole=hole,scaledRectPadWidth=pillHole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=pillHole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(pillHole.rect_border_radius??0)*Math.abs(transform6.a),scaledHoleHeight=pillHole.hole_height*Math.abs(transform6.a),scaledHoleWidth=pillHole.hole_width*Math.abs(transform6.a),pillHoleWithOffsets=pillHole,holeOffsetX=pillHoleWithOffsets.hole_offset_x??0,holeOffsetY=pillHoleWithOffsets.hole_offset_y??0,[holeCenterX,holeCenterY]=applyToPoint3(transform6,[pillHole.x+holeOffsetX,pillHole.y+holeOffsetY]),holeRadius=Math.min(scaledHoleHeight,scaledHoleWidth)/2,children=[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:colorMap2.copper.top,x:(x4-scaledRectPadWidth/2).toString(),y:(y4-scaledRectPadHeight/2).toString(),width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,x:(holeCenterX-scaledHoleWidth/2).toString(),y:(holeCenterY-scaledHoleHeight/2).toString(),width:scaledHoleWidth.toString(),height:scaledHoleHeight.toString(),rx:holeRadius.toString(),ry:holeRadius.toString(),"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}];if(shouldShowSolderMask){let maskWidth=scaledRectPadWidth+2*soldermaskMargin,maskHeight=scaledRectPadHeight+2*soldermaskMargin,maskBorderRadius=scaledRectBorderRadius+soldermaskMargin;soldermaskMargin<0?children=[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-covered",fill:solderMaskColor,x:(x4-scaledRectPadWidth/2).toString(),y:(y4-scaledRectPadHeight/2).toString(),width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-exposed",fill:colorMap2.copper.top,x:(x4-maskWidth/2).toString(),y:(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),...maskBorderRadius>0?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{},"data-type":"pcb_soldermask","data-pcb-layer":maskLayer},value:"",children:[]},children[1]]:children.unshift({name:"rect",type:"element",attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(x4-maskWidth/2).toString(),y:(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),...scaledRectBorderRadius?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{},"data-type":"pcb_soldermask_opening","data-pcb-layer":maskLayer},value:"",children:[]})}return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children,value:""}]}if(hole.shape==="rotated_pill_hole_with_rect_pad"){let rotatedHole=hole,scaledRectPadWidth=rotatedHole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=rotatedHole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(rotatedHole.rect_border_radius??0)*Math.abs(transform6.a),scaledHoleHeight=rotatedHole.hole_height*Math.abs(transform6.a),scaledHoleWidth=rotatedHole.hole_width*Math.abs(transform6.a),rotatedHoleWithOffsets=rotatedHole,holeOffsetX=rotatedHoleWithOffsets.hole_offset_x??0,holeOffsetY=rotatedHoleWithOffsets.hole_offset_y??0,[holeCenterX,holeCenterY]=applyToPoint3(transform6,[rotatedHole.x+holeOffsetX,rotatedHole.y+holeOffsetY]),holeRadius=Math.min(scaledHoleHeight,scaledHoleWidth)/2,children=[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:colorMap2.copper.top,x:(-scaledRectPadWidth/2).toString(),y:(-scaledRectPadHeight/2).toString(),width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),transform:`translate(${x4} ${y4}) rotate(${-rotatedHole.rect_ccw_rotation})`,...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,x:(-scaledHoleWidth/2).toString(),y:(-scaledHoleHeight/2).toString(),width:scaledHoleWidth.toString(),height:scaledHoleHeight.toString(),rx:holeRadius.toString(),ry:holeRadius.toString(),transform:`translate(${holeCenterX} ${holeCenterY}) rotate(${-rotatedHole.hole_ccw_rotation})`,"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}];if(shouldShowSolderMask){let maskWidth=scaledRectPadWidth+2*soldermaskMargin,maskHeight=scaledRectPadHeight+2*soldermaskMargin,maskBorderRadius=scaledRectBorderRadius+soldermaskMargin;soldermaskMargin<0?children=[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-covered",fill:solderMaskColor,x:(-scaledRectPadWidth/2).toString(),y:(-scaledRectPadHeight/2).toString(),width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),transform:`translate(${x4} ${y4}) rotate(${-rotatedHole.rect_ccw_rotation})`,...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-exposed",fill:colorMap2.copper.top,x:(-maskWidth/2).toString(),y:(-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),transform:`translate(${x4} ${y4}) rotate(${-rotatedHole.rect_ccw_rotation})`,...maskBorderRadius>0?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{},"data-type":"pcb_soldermask","data-pcb-layer":maskLayer},value:"",children:[]},children[1]]:children.push({name:"rect",type:"element",attributes:{class:"pcb-solder-mask",fill:solderMaskColor,x:(-maskWidth/2).toString(),y:(-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),transform:`translate(${x4} ${y4}) rotate(${-rotatedHole.rect_ccw_rotation})`,...scaledRectBorderRadius?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{},"data-type":"pcb_soldermask","data-pcb-layer":maskLayer},value:"",children:[]})}return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children,value:""}]}if(hole.shape==="hole_with_polygon_pad"){let polygonHole=hole,padOutline=polygonHole.pad_outline||[],holeX=polygonHole.x??0,holeY=polygonHole.y??0,padPointsString=padOutline.map(point7=>applyToPoint3(transform6,[holeX+point7.x,holeY+point7.y])).map(p4=>p4.join(",")).join(" "),[holeCenterX,holeCenterY]=applyToPoint3(transform6,[holeX+polygonHole.hole_offset_x,holeY+polygonHole.hole_offset_y]),createHoleSvgObject=()=>{if(polygonHole.hole_shape==="circle"){let radius=(polygonHole.hole_diameter??0)*Math.abs(transform6.a)/2;return{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,cx:holeCenterX.toString(),cy:holeCenterY.toString(),r:radius.toString(),"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}}if(polygonHole.hole_shape==="oval"){let scaledWidth=(polygonHole.hole_width??0)*Math.abs(transform6.a),scaledHeight=(polygonHole.hole_height??0)*Math.abs(transform6.a),rx3=scaledWidth/2,ry3=scaledHeight/2;return{name:"ellipse",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,cx:holeCenterX.toString(),cy:holeCenterY.toString(),rx:rx3.toString(),ry:ry3.toString(),"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}}if(polygonHole.hole_shape==="pill"||polygonHole.hole_shape==="rotated_pill"){let scaledWidth=(polygonHole.hole_width??0)*Math.abs(transform6.a),scaledHeight=(polygonHole.hole_height??0)*Math.abs(transform6.a),isHorizontal3=scaledWidth>scaledHeight,radius=Math.min(scaledWidth,scaledHeight)/2,straightLength=Math.abs(isHorizontal3?scaledWidth-scaledHeight:scaledHeight-scaledWidth),pathD=isHorizontal3?`M${-straightLength/2},${-radius} h${straightLength} a${radius},${radius} 0 0 1 0,${scaledHeight} h-${straightLength} a${radius},${radius} 0 0 1 0,-${scaledHeight} z`:`M${-radius},${-straightLength/2} v${straightLength} a${radius},${radius} 0 0 0 ${scaledWidth},0 v-${straightLength} a${radius},${radius} 0 0 0 -${scaledWidth},0 z`;return{name:"path",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,d:pathD,transform:`translate(${holeCenterX} ${holeCenterY})`,"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}}return{name:"g",type:"element",attributes:{},value:"",children:[]}};return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children:[{name:"polygon",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:colorMap2.copper.top,points:padPointsString,"data-type":"pcb_plated_hole","data-pcb-layer":layer},value:"",children:[]},createHoleSvgObject()],value:""}]}return[]}function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx;if(!silkscreenPath.route||!Array.isArray(silkscreenPath.route))return[];let path=silkscreenPath.route.map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" "),firstPoint=silkscreenPath.route[0],lastPoint=silkscreenPath.route[silkscreenPath.route.length-1];firstPoint&&lastPoint&&firstPoint.x===lastPoint.x&&firstPoint.y===lastPoint.y&&(path+=" Z");let layer=silkscreenPath.layer||"top";if(layerFilter&&layer!==layerFilter)return[];let color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"path",type:"element",attributes:{class:`pcb-silkscreen pcb-silkscreen-${layer}`,d:path,fill:"none",stroke:color,"stroke-width":(silkscreenPath.stroke_width*Math.abs(transform6.a)).toString(),"stroke-linecap":"round","stroke-linejoin":"round","data-pcb-component-id":silkscreenPath.pcb_component_id,"data-pcb-silkscreen-path-id":silkscreenPath.pcb_silkscreen_path_id,"data-type":"pcb_silkscreen_path","data-pcb-layer":layer},value:"",children:[]}]}function linesToPathData(lines,offsetX,offsetY,charScale){return lines.map(line2=>{let x12=offsetX+line2.x1*charScale,y12=offsetY+(1-line2.y1)*charScale,x22=offsetX+line2.x2*charScale,y22=offsetY+(1-line2.y2)*charScale;return`M${x12} ${y12}L${x22} ${y22}`}).join(" ")}function textToCenteredAlphabetPaths(text,fontSize){let textLines=text.split(`
|
|
227
|
-
`),charSpacing=alphabetBounds.width*INTER_CHAR_SPACING_RATIO,lineHeight=fontSize*alphabetBounds.height*LINE_HEIGHT_MULTIPLIER,totalHeight=textLines.length*lineHeight,charAdvance=(alphabetBounds.width+charSpacing)*fontSize,lineWidths=[],maxWidth=0;for(let line2 of textLines){let width=0;for(let char of line2)char===" "?width+=charAdvance*.6:width+=charAdvance;width=width>0?width-charSpacing*fontSize:0,lineWidths.push(width),width>maxWidth&&(maxWidth=width)}let paths=[],y4=-totalHeight/2;for(let i3=0;i3<textLines.length;i3++){let line2=textLines[i3],x4=-lineWidths[i3]/2;for(let char of line2){if(char===" "){x4+=charAdvance*.6;continue}let charLines=lineAlphabet[char];charLines&&paths.push(linesToPathData(charLines,x4,y4,fontSize)),x4+=charAdvance}y4+=lineHeight}return{pathData:paths.join(" "),width:maxWidth,height:totalHeight}}function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{anchor_position,text,font_size=1,layer="top",ccw_rotation=0,anchor_alignment="center",is_knockout=!1,knockout_padding,is_mirrored=!1}=pcbSilkscreenText;if(layerFilter&&layer!==layerFilter)return[];if(!anchor_position||typeof anchor_position.x!="number"||typeof anchor_position.y!="number")return debugPcb(`[pcb_silkscreen_text] Invalid anchor_position for "${pcbSilkscreenText.pcb_silkscreen_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[anchor_position.x,anchor_position.y]),scaleFactor=Math.abs(transform6.a),silkscreenColor=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top,applyMirror=layer==="bottom"?!0:is_mirrored===!0;if(is_knockout){let scaledFontSize=font_size*.6666666666666666/alphabetBounds.height,{pathData,width,height}=textToCenteredAlphabetPaths(text,scaledFontSize),padLeft=knockout_padding?.left??scaledFontSize*.5,padRight=knockout_padding?.right??scaledFontSize*.5,padTop=knockout_padding?.top??scaledFontSize*.3,padBottom=knockout_padding?.bottom??scaledFontSize*.3,rectX=-width/2-padLeft,rectY=-height/2-padTop,rectW=width+padLeft+padRight,rectH=height+padTop+padBottom,strokeWidth=scaledFontSize*.15,knockoutTransform=
|
|
228
|
-
`),children=lines.length===1?[{type:"text",value:text,name:"",attributes:{},children:[]}]:lines.map((line2,idx)=>({type:"element",name:"tspan",value:"",attributes:{x:"0",...idx>0?{dy:transformedFontSize.toString()}:{}},children:[{type:"text",value:line2,name:"",attributes:{},children:[]}]}));return[{name:"text",type:"element",attributes:{x:"0",y:"0",dx:dx3.toString(),dy:dy3.toString(),fill:silkscreenColor,"font-family":"Arial, sans-serif","font-size":transformedFontSize.toString(),"text-anchor":textAnchor,"dominant-baseline":dominantBaseline,transform:
|
|
229
|
-
`),lineHeight=fontSize*LINE_HEIGHT,totalHeight=textLines.length*lineHeight,lineWidths=[],maxWidth=0;for(let line2 of textLines){let{width}=textToAlphabetPath(line2,fontSize);lineWidths.push(width),width>maxWidth&&(maxWidth=width)}let paths=[],y4=-totalHeight/2;for(let i3=0;i3<textLines.length;i3++){let line2=textLines[i3],lineWidth=lineWidths[i3],charAdvance=(CHAR_WIDTH+CHAR_SPACING)*fontSize,x4=-lineWidth/2;for(let char of line2){if(char===" "){x4+=charAdvance*.6;continue}let charLines=lineAlphabet[char];charLines&&paths.push(linesToPathData2(charLines,x4,y4,fontSize)),x4+=charAdvance}y4+=lineHeight}return{pathData:paths.join(" "),width:maxWidth,height:totalHeight}}function createSvgObjectsFromPcbCopperText(pcbCopperText,ctx){let{transform:transform6,layer:filterLayer,colorMap:colorMap2}=ctx,{anchor_position,text,font_size="0.2mm",layer,ccw_rotation=0,anchor_alignment="center",is_knockout=!1,knockout_padding,is_mirrored=!1}=pcbCopperText,layerName=layer??"top";if(filterLayer&&filterLayer!==layerName)return[];if(!anchor_position)return[];let[ax3,ay3]=applyToPoint3(transform6,[anchor_position.x,anchor_position.y]),fontSizeNum=distance.parse(font_size)??.2,scaleFactor=Math.abs(transform6.a),copperColor=layerNameToColor(layerName,colorMap2),applyMirror=layerName==="bottom"?!0:is_mirrored===!0;if(is_knockout){let scaledFontSize2=fontSizeNum*FONT_SCALE,{pathData:pathData2,width:width2,height:height2}=textToCenteredAlphabetPaths2(text,scaledFontSize2),padX=knockout_padding?.left??scaledFontSize2*.5,padY=knockout_padding?.top??scaledFontSize2*.3,rectW=width2+padX*2,rectH=height2+padY*2,strokeWidth2=scaledFontSize2*.15,knockoutTransform=toString(compose3(translate3(ax3,ay3),rotate3(-ccw_rotation*Math.PI/180),...applyMirror?[scale3(-1,1)]:[],scale3(scaleFactor,scaleFactor))),maskId=`knockout-mask-${pcbCopperText.pcb_copper_text_id}-${maskIdCounter++}`;return[{name:"defs",type:"element",value:"",children:[{name:"mask",type:"element",value:"",attributes:{id:maskId},children:[{name:"rect",type:"element",value:"",attributes:{x:(-rectW/2).toString(),y:(-rectH/2).toString(),width:rectW.toString(),height:rectH.toString(),fill:"white"},children:[]},{name:"path",type:"element",value:"",attributes:{d:pathData2,fill:"none",stroke:"black","stroke-width":strokeWidth2.toString(),"stroke-linecap":"round","stroke-linejoin":"round"},children:[]}]}],attributes:{}},{name:"rect",type:"element",value:"",children:[],attributes:{x:(-rectW/2).toString(),y:(-rectH/2).toString(),width:rectW.toString(),height:rectH.toString(),fill:copperColor,mask:`url(#${maskId})`,transform:knockoutTransform,class:`pcb-copper-text-knockout pcb-copper-${layerName}`,"data-type":"pcb_copper_text","data-pcb-copper-text-id":pcbCopperText.pcb_copper_text_id}}]}let scaledFontSize=fontSizeNum*FONT_SCALE,{pathData,width,height}=textToCenteredAlphabetPaths2(text,scaledFontSize),offsetX=0,offsetY=0;switch(anchor_alignment){case"top_left":offsetX=width/2,offsetY=height/2;break;case"top_center":offsetY=height/2;break;case"top_right":offsetX=-width/2,offsetY=height/2;break;case"center_left":offsetX=width/2;break;case"center_right":offsetX=-width/2;break;case"bottom_left":offsetX=width/2,offsetY=-height/2;break;case"bottom_center":offsetY=-height/2;break;case"bottom_right":offsetX=-width/2,offsetY=-height/2;break}let textTransform=toString(compose3(translate3(ax3,ay3),rotate3(-ccw_rotation*Math.PI/180),...applyMirror?[scale3(-1,1)]:[],translate3(offsetX,offsetY),scale3(scaleFactor,scaleFactor))),strokeWidth=scaledFontSize*.15;return[{name:"path",type:"element",attributes:{d:pathData,fill:"none",stroke:copperColor,"stroke-width":strokeWidth.toString(),"stroke-linecap":"round","stroke-linejoin":"round",transform:textTransform,class:`pcb-copper-text pcb-copper-${layerName}`,"data-type":"pcb_copper_text","data-pcb-copper-text-id":pcbCopperText.pcb_copper_text_id},children:[],value:""}]}function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,radius,layer="top",pcb_silkscreen_circle_id,stroke_width=1,is_filled}=pcbSilkscreenCircle;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof radius!="number")return console.error("Invalid PCB Silkscreen Circle data:",{center:center2,radius}),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedRadius=radius*Math.abs(transform6.a),transformedStrokeWidth=stroke_width*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"circle",type:"element",attributes:{cx:transformedX.toString(),cy:transformedY.toString(),r:transformedRadius.toString(),class:`pcb-silkscreen-circle pcb-silkscreen-${layer}`,fill:is_filled?color:"none",stroke:color,"stroke-width":transformedStrokeWidth.toString(),"data-pcb-silkscreen-circle-id":pcb_silkscreen_circle_id,"data-type":"pcb_silkscreen_circle","data-pcb-layer":layer},value:"",children:[]}]}function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{x1:x12,y1:y12,x2:x22,y2:y22,stroke_width,layer="top",pcb_silkscreen_line_id}=pcbSilkscreenLine;if(layerFilter&&layer!==layerFilter)return[];if(typeof x12!="number"||typeof y12!="number"||typeof x22!="number"||typeof y22!="number")return debugPcb(`[pcb_silkscreen_line] Invalid coordinates for "${pcb_silkscreen_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`),[];let[transformedX1,transformedY1]=applyToPoint3(transform6,[x12,y12]),[transformedX2,transformedY2]=applyToPoint3(transform6,[x22,y22]),transformedStrokeWidth=stroke_width*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"line",type:"element",attributes:{x1:transformedX1.toString(),y1:transformedY1.toString(),x2:transformedX2.toString(),y2:transformedY2.toString(),stroke:color,"stroke-width":transformedStrokeWidth.toString(),class:`pcb-silkscreen-line pcb-silkscreen-${layer}`,"data-pcb-silkscreen-line-id":pcb_silkscreen_line_id,"data-type":"pcb_silkscreen_line","data-pcb-layer":layer},value:"",children:[]}]}function createSvgObjectsFromPcbSilkscreenPill(pcbSilkscreenPill,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,width,height,layer="top",pcb_silkscreen_pill_id}=pcbSilkscreenPill;if(layerFilter&&layer!==layerFilter)return[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedWidth=width*Math.abs(transform6.a),transformedHeight=height*Math.abs(transform6.d),baseCornerRadius=Math.min(width,height)/2,transformedCornerRadiusX=baseCornerRadius*Math.abs(transform6.a),transformedCornerRadiusY=baseCornerRadius*Math.abs(transform6.d),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"rect",type:"element",attributes:{x:(transformedX-transformedWidth/2).toString(),y:(transformedY-transformedHeight/2).toString(),width:transformedWidth.toString(),height:transformedHeight.toString(),rx:transformedCornerRadiusX.toString(),ry:transformedCornerRadiusY.toString(),fill:"none",stroke:color,"stroke-width":(.1*Math.abs(transform6.a)).toString(),class:`pcb-silkscreen-pill pcb-silkscreen-${layer}`,"data-pcb-silkscreen-pill-id":pcb_silkscreen_pill_id,"data-type":"pcb_silkscreen_pill","data-pcb-layer":layer},value:"",children:[]}]}function createSvgObjectsFromPcbSilkscreenOval(pcbSilkscreenOval,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,radius_x,radius_y,layer="top",pcb_silkscreen_oval_id,ccw_rotation=0}=pcbSilkscreenOval;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof radius_x!="number"||typeof radius_y!="number")return debugPcb(`[pcb_silkscreen_oval] Invalid data for "${pcb_silkscreen_oval_id}": expected center {x: number, y: number}, radius_x: number, radius_y: number, got center=${JSON.stringify(center2)}, radius_x=${JSON.stringify(radius_x)}, radius_y=${JSON.stringify(radius_y)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedRadiusX=radius_x*Math.abs(transform6.a),transformedRadiusY=radius_y*Math.abs(transform6.d),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"ellipse",type:"element",attributes:{cx:transformedX.toString(),cy:transformedY.toString(),rx:transformedRadiusX.toString(),ry:transformedRadiusY.toString(),fill:"none",stroke:color,"stroke-width":(.1*Math.abs(transform6.a)).toString(),class:`pcb-silkscreen-oval pcb-silkscreen-${layer}`,"data-pcb-silkscreen-oval-id":pcb_silkscreen_oval_id,"data-type":"pcb_silkscreen_oval","data-pcb-layer":layer,...ccw_rotation!==0&&{transform:`rotate(${-ccw_rotation} ${transformedX} ${transformedY})`}},value:"",children:[]}]}function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,width,height,layer="top",pcb_courtyard_rect_id,ccw_rotation=0}=pcbCourtyardRect;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof width!="number"||typeof height!="number")return debugPcb(`[pcb_courtyard_rect] Invalid data for "${pcb_courtyard_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center2)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedWidth=width*Math.abs(transform6.a),transformedHeight=height*Math.abs(transform6.d),transformedStrokeWidth=.05*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.courtyard.bottom:colorMap2.courtyard.top,attributes2={x:(-transformedWidth/2).toString(),y:(-transformedHeight/2).toString(),width:transformedWidth.toString(),height:transformedHeight.toString(),class:`pcb-courtyard-rect pcb-courtyard-${layer}`,"data-pcb-courtyard-rect-id":pcb_courtyard_rect_id,"data-type":"pcb_courtyard_rect","data-pcb-layer":layer,"stroke-linejoin":"round"};return typeof ccw_rotation=="number"&&ccw_rotation!==0?attributes2.transform=`translate(${transformedX} ${transformedY}) rotate(${-ccw_rotation})`:(attributes2.x=(transformedX-transformedWidth/2).toString(),attributes2.y=(transformedY-transformedHeight/2).toString()),attributes2.fill="none",attributes2.stroke=color,attributes2["stroke-width"]=transformedStrokeWidth.toString(),[{name:"rect",type:"element",attributes:attributes2,value:"",children:[]}]}function createSvgObjectsFromPcbCourtyardPolygon(pcbCourtyardPolygon,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{layer="top",pcb_courtyard_polygon_id,points,color}=pcbCourtyardPolygon;if(layerFilter&&layer!==layerFilter)return[];if(!points||points.length===0)return debugPcb(`[pcb_courtyard_polygon] Invalid data for "${pcb_courtyard_polygon_id}": expected non-empty array of points, got ${JSON.stringify(points)}`),[];let pointsString=points.map(p4=>applyToPoint3(transform6,[p4.x,p4.y])).map(p4=>`${p4[0]},${p4[1]}`).join(" "),transformedStrokeWidth=.05*Math.abs(transform6.a),strokeColor=color??(layer==="bottom"?colorMap2.courtyard.bottom:colorMap2.courtyard.top);return[{name:"polygon",type:"element",attributes:{points:pointsString,class:`pcb-courtyard-polygon pcb-courtyard-${layer}`,"data-pcb-courtyard-polygon-id":pcb_courtyard_polygon_id,"data-type":"pcb_courtyard_polygon","data-pcb-layer":layer,fill:"none",stroke:strokeColor,"stroke-width":transformedStrokeWidth.toString(),"stroke-linejoin":"round"},value:"",children:[]}]}function createSvgObjectsFromPcbCourtyardOutline(pcbCourtyardOutline,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{layer,pcb_courtyard_outline_id,outline}=pcbCourtyardOutline;if(layerFilter&&layer!==layerFilter)return[];if(!outline||outline.length===0)return debugPcb(`[pcb_courtyard_outline] Invalid data for "${pcb_courtyard_outline_id}": expected non-empty array of points, got ${JSON.stringify(outline)}`),[];let pointsString=outline.map(p4=>applyToPoint3(transform6,[p4.x,p4.y])).map(p4=>`${p4[0]},${p4[1]}`).join(" "),transformedStrokeWidth=.05*Math.abs(transform6.a),strokeColor=layer==="bottom"?colorMap2.courtyard.bottom:colorMap2.courtyard.top;return[{name:"polygon",type:"element",attributes:{points:pointsString,class:`pcb-courtyard-outline pcb-courtyard-${layer}`,"data-pcb-courtyard-outline-id":pcb_courtyard_outline_id,"data-type":"pcb_courtyard_outline","data-pcb-layer":layer,fill:"none",stroke:strokeColor,"stroke-width":transformedStrokeWidth.toString(),"stroke-linejoin":"round"},value:"",children:[]}]}function createSvgObjectsFromPcbCourtyardCircle(pcbCourtyardCircle,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,radius,layer="top",pcb_courtyard_circle_id}=pcbCourtyardCircle;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof radius!="number")return console.error(`[pcb_courtyard_circle] Invalid data for "${pcb_courtyard_circle_id}": expected center {x: number, y: number}, radius: number, got center=${JSON.stringify(center2)}, radius=${JSON.stringify(radius)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedRadius=radius*Math.abs(transform6.a),transformedStrokeWidth=.05*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.courtyard.bottom:colorMap2.courtyard.top,attributes2={cx:transformedX.toString(),cy:transformedY.toString(),r:transformedRadius.toString(),class:`pcb-courtyard-circle pcb-courtyard-${layer}`,"data-pcb-courtyard-circle-id":pcb_courtyard_circle_id,"data-type":"pcb_courtyard_circle","data-pcb-layer":layer};return attributes2.fill="none",attributes2.stroke=color,attributes2["stroke-width"]=transformedStrokeWidth.toString(),[{name:"circle",type:"element",attributes:attributes2,value:"",children:[]}]}function pairs(arr){let result=[];for(let i3=0;i3<arr.length-1;i3++)result.push([arr[i3],arr[i3+1]]);return result}function createSvgObjectsFromPcbTrace(trace,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2,showSolderMask}=ctx;if(!trace.route||!Array.isArray(trace.route)||trace.route.length<2)return[];let segments=pairs(trace.route),svgObjects=[];for(let[start,end]of segments){if(start.is_inside_copper_pour===!0&&end.is_inside_copper_pour===!0)continue;let startPoint=applyToPoint3(transform6,[start.x,start.y]),endPoint=applyToPoint3(transform6,[end.x,end.y]),layer="layer"in start?start.layer:"layer"in end?end.layer:null;if(!layer||layerFilter&&layer!==layerFilter)continue;let maskLayer=layer,copperColor=layerNameToColor(layer,colorMap2),maskColor=colorMap2.soldermaskWithCopperUnderneath[layer],traceWidth="width"in start?start.width:"width"in end?end.width:null,width=traceWidth?(traceWidth*Math.abs(transform6.a)).toString():"0.3";if(showSolderMask){let maskObject={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask",stroke:maskColor,fill:"none",d:`M ${startPoint[0]} ${startPoint[1]} L ${endPoint[0]} ${endPoint[1]}`,"stroke-width":width,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-type":"pcb_trace_soldermask","data-pcb-layer":layer}};svgObjects.push(maskObject)}else{let maskOnlyObject={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-trace",stroke:copperColor,fill:"none",d:`M ${startPoint[0]} ${startPoint[1]} L ${endPoint[0]} ${endPoint[1]}`,"stroke-width":width,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-type":showSolderMask?"pcb_soldermask":"pcb_trace","data-pcb-layer":layer}};svgObjects.push(maskOnlyObject)}}return svgObjects}function createSvgObjectsFromSmtPad(pad2,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2,showSolderMask}=ctx;if(layerFilter&&pad2.layer!==layerFilter)return[];let isCoveredWithSolderMask=!!pad2?.is_covered_with_solder_mask,shouldShowSolderMask=showSolderMask&&isCoveredWithSolderMask,soldermaskWithCopperUnderneathColor=colorMap2.soldermaskWithCopperUnderneath[pad2.layer]??colorMap2.soldermaskWithCopperUnderneath.top,soldermaskMargin=(pad2.soldermask_margin??0)*Math.abs(transform6.a);if(pad2.shape==="rect"||pad2.shape==="rotated_rect"){let width=pad2.width*Math.abs(transform6.a),height=pad2.height*Math.abs(transform6.d),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]),scaledBorderRadius=(pad2.corner_radius??pad2.rect_border_radius??0)*Math.abs(transform6.a),m4={left:(pad2.soldermask_margin_left??pad2.soldermask_margin??0)*Math.abs(transform6.a),right:(pad2.soldermask_margin_right??pad2.soldermask_margin??0)*Math.abs(transform6.a),top:(pad2.soldermask_margin_top??pad2.soldermask_margin??0)*Math.abs(transform6.a),bottom:(pad2.soldermask_margin_bottom??pad2.soldermask_margin??0)*Math.abs(transform6.a)},isNegativeMargin=m4.left<0||m4.right<0||m4.top<0||m4.bottom<0,isZeroMargin=m4.left===0&&m4.right===0&&m4.top===0&&m4.bottom===0;if(pad2.shape==="rotated_rect"&&pad2.ccw_rotation){let padElement2={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),x:(-width/2).toString(),y:(-height/2).toString(),width:width.toString(),height:height.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}};if(!shouldShowSolderMask)return[padElement2];let maskWidth2=width+m4.left+m4.right,maskHeight2=height+m4.top+m4.bottom,maskBorderRadius2=scaledBorderRadius?scaledBorderRadius+soldermaskMargin:0;if(isNegativeMargin){let coveredPadElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:(-width/2).toString(),y:(-height/2).toString(),width:width.toString(),height:height.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}},exposedOpeningElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),x:(-width/2-m4.left).toString(),y:(-height/2-m4.top).toString(),width:maskWidth2.toString(),height:maskHeight2.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer,...maskBorderRadius2>0?{rx:maskBorderRadius2.toString(),ry:maskBorderRadius2.toString()}:{}}};return[coveredPadElement,exposedOpeningElement]}return isZeroMargin?[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:(-width/2).toString(),y:(-height/2).toString(),width:width.toString(),height:height.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}}]:[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(-width/2-m4.left).toString(),y:(-height/2-m4.top).toString(),width:maskWidth2.toString(),height:maskHeight2.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,...maskBorderRadius2>0?{rx:maskBorderRadius2.toString(),ry:maskBorderRadius2.toString()}:{},"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer}},padElement2]}let padElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}};if(!shouldShowSolderMask)return[padElement];let maskWidth=width+m4.left+m4.right,maskHeight=height+m4.top+m4.bottom,maskBorderRadius=scaledBorderRadius?scaledBorderRadius+soldermaskMargin:0;if(isNegativeMargin){let coveredPadElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}},exposedOpeningElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),x:(x4-width/2-m4.left).toString(),y:(y4-height/2-m4.top).toString(),width:maskWidth.toString(),height:maskHeight.toString(),"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer,...maskBorderRadius>0?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{}}};return[coveredPadElement,exposedOpeningElement]}return isZeroMargin?[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),...maskBorderRadius>0?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{},"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}}]:[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(x4-width/2-m4.left).toString(),y:(y4-height/2-m4.top).toString(),width:maskWidth.toString(),height:maskHeight.toString(),...maskBorderRadius>0?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{},"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer}},padElement]}if(pad2.shape==="pill"||pad2.shape==="rotated_pill"){let isRotated=pad2.shape==="rotated_pill",width=pad2.width*Math.abs(transform6.a),height=pad2.height*Math.abs(transform6.d),radius=pad2.radius*Math.abs(transform6.a),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]),rotationTransformAttributes=isRotated?{transform:`translate(${x4} ${y4}) rotate(${-(pad2.ccw_rotation??0)})`}:void 0,baseAttributes={class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),x:isRotated?(-width/2).toString():(x4-width/2).toString(),y:isRotated?(-height/2).toString():(y4-height/2).toString(),width:width.toString(),height:height.toString(),rx:radius.toString(),ry:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}},padElement={name:"rect",type:"element",value:"",children:[],attributes:baseAttributes};if(!shouldShowSolderMask)return[padElement];let maskWidth=width+2*soldermaskMargin,maskHeight=height+2*soldermaskMargin,maskRadius=radius+soldermaskMargin;if(soldermaskMargin<0){let coveredPadElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:isRotated?(-width/2).toString():(x4-width/2).toString(),y:isRotated?(-height/2).toString():(y4-height/2).toString(),width:width.toString(),height:height.toString(),rx:radius.toString(),ry:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}}},exposedAttributes={class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),x:isRotated?(-maskWidth/2).toString():(x4-maskWidth/2).toString(),y:isRotated?(-maskHeight/2).toString():(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),rx:maskRadius.toString(),ry:maskRadius.toString(),"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}};return[coveredPadElement,{name:"rect",type:"element",value:"",children:[],attributes:exposedAttributes}]}if(soldermaskMargin===0)return[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:isRotated?(-width/2).toString():(x4-width/2).toString(),y:isRotated?(-height/2).toString():(y4-height/2).toString(),width:width.toString(),height:height.toString(),rx:radius.toString(),ry:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}}}];let substrateAttributes={class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:isRotated?(-maskWidth/2).toString():(x4-maskWidth/2).toString(),y:isRotated?(-maskHeight/2).toString():(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),rx:maskRadius.toString(),ry:maskRadius.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}};return[{name:"rect",type:"element",value:"",children:[],attributes:substrateAttributes},padElement]}if(pad2.shape==="circle"){let radius=pad2.radius*Math.abs(transform6.a),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]),padElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}};if(!shouldShowSolderMask)return[padElement];let maskRadius=radius+soldermaskMargin;if(soldermaskMargin<0){let coveredPadElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}},exposedOpeningElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer}};return[coveredPadElement,exposedOpeningElement]}return soldermaskMargin===0?[{name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}}]:[{name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer}},padElement]}if(pad2.shape==="polygon"){let points=(pad2.points??[]).map(point7=>applyToPoint3(transform6,[point7.x,point7.y])),padElement={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),points:points.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}};if(!shouldShowSolderMask)return[padElement];let maskPoints=points;if(soldermaskMargin!==0){let centroidX=points.reduce((sum,p4)=>sum+p4[0],0)/points.length,centroidY=points.reduce((sum,p4)=>sum+p4[1],0)/points.length;maskPoints=points.map(([px3,py3])=>{let dx3=px3-centroidX,dy3=py3-centroidY,distance62=Math.sqrt(dx3*dx3+dy3*dy3);if(distance62===0)return[px3,py3];let normalizedDx=dx3/distance62,normalizedDy=dy3/distance62;return[px3+normalizedDx*soldermaskMargin,py3+normalizedDy*soldermaskMargin]})}if(soldermaskMargin<0){let coveredPadElement={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,points:points.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}},exposedOpeningElement={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),points:maskPoints.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer}};return[coveredPadElement,exposedOpeningElement]}return soldermaskMargin===0?[{name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,points:points.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}}]:[{name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,points:maskPoints.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer}},padElement]}return[]}function createAnchorOffsetIndicators(params){let{groupAnchorPosition,componentPosition,transform:transform6,componentWidth=0,componentHeight=0,displayXOffset,displayYOffset}=params,objects=[],[screenGroupAnchorX,screenGroupAnchorY]=applyToPoint3(transform6,[groupAnchorPosition.x,groupAnchorPosition.y]),[screenComponentX,screenComponentY]=applyToPoint3(transform6,[componentPosition.x,componentPosition.y]),offsetX=componentPosition.x-groupAnchorPosition.x,offsetY=componentPosition.y-groupAnchorPosition.y,scale10=Math.abs(transform6.a),screenComponentWidth=componentWidth*scale10,screenComponentHeight=componentHeight*scale10;objects.push(createAnchorMarker(screenGroupAnchorX,screenGroupAnchorY));let trimmedConnector=getTrimmedConnectorLine(screenGroupAnchorX,screenGroupAnchorY,screenComponentX,screenComponentY);objects.push({name:"line",type:"element",attributes:{x1:trimmedConnector.x1.toString(),y1:trimmedConnector.y1.toString(),x2:trimmedConnector.x2.toString(),y2:trimmedConnector.y2.toString(),stroke:"#ffffff","stroke-width":"0.5","stroke-dasharray":"3,3",opacity:"0.5",class:"anchor-offset-connector"},children:[],value:""}),objects.push({name:"circle",type:"element",attributes:{cx:screenComponentX.toString(),cy:screenComponentY.toString(),r:COMPONENT_ANCHOR_MARKER_RADIUS_PX.toString(),fill:"#ffffff",opacity:"0.7",class:"anchor-offset-component-marker"},children:[],value:""});let yDistance=Math.abs(screenComponentY-screenGroupAnchorY),xDistance=Math.abs(screenComponentX-screenGroupAnchorX),totalDistance=Math.sqrt(xDistance*xDistance+yDistance*yDistance),componentHeightOffset=screenComponentHeight/2+COMPONENT_GAP_PX,dynamicOffset=Math.max(componentHeightOffset,Math.min(MAX_OFFSET_PX,totalDistance*DISTANCE_MULTIPLIER)),horizontalLineY=offsetY>0?screenComponentY-dynamicOffset:screenComponentY+dynamicOffset,componentWidthOffset=screenComponentWidth/2+COMPONENT_SIDE_GAP_PX,verticalLineX=offsetX>0?screenComponentX+componentWidthOffset:screenComponentX-componentWidthOffset;if(isTooCloseToAnchor(horizontalLineY,screenGroupAnchorY)||isTooCloseToAnchor(horizontalLineY,screenComponentY)){let minY=Math.min(screenGroupAnchorY,screenComponentY),maxY=Math.max(screenGroupAnchorY,screenComponentY),candidateAbove=minY-DIMENSION_ANCHOR_CLEARANCE_PX,candidateBelow=maxY+DIMENSION_ANCHOR_CLEARANCE_PX;horizontalLineY=Math.abs(horizontalLineY-candidateAbove)<Math.abs(horizontalLineY-candidateBelow)?candidateAbove:candidateBelow}if(isTooCloseToAnchor(verticalLineX,screenGroupAnchorX)||isTooCloseToAnchor(verticalLineX,screenComponentX)){let minX=Math.min(screenGroupAnchorX,screenComponentX),maxX=Math.max(screenGroupAnchorX,screenComponentX),candidateLeft=minX-DIMENSION_ANCHOR_CLEARANCE_PX,candidateRight=maxX+DIMENSION_ANCHOR_CLEARANCE_PX;verticalLineX=Math.abs(verticalLineX-candidateLeft)<Math.abs(verticalLineX-candidateRight)?candidateLeft:candidateRight}return Math.abs(offsetX)>OFFSET_THRESHOLD_MM&&objects.push(...createHorizontalDimension({startX:screenGroupAnchorX,endX:screenComponentX,y:horizontalLineY,offsetMm:offsetX,offsetY,displayOffset:displayXOffset})),Math.abs(offsetY)>OFFSET_THRESHOLD_MM&&objects.push(...createVerticalDimension({x:verticalLineX,startY:screenGroupAnchorY,endY:screenComponentY,offsetMm:offsetY,offsetX,displayOffset:displayYOffset})),objects}function getTrimmedConnectorLine(x12,y12,x22,y22){let dx3=x22-x12,dy3=y22-y12,distance62=Math.hypot(dx3,dy3),totalTrim=CONNECTOR_GROUP_GAP_PX+CONNECTOR_COMPONENT_GAP_PX;if(!(distance62>totalTrim))return{x1:x12,y1:y12,x2:x22,y2:y22};let ux3=dx3/distance62,uy3=dy3/distance62;return{x1:x12+ux3*CONNECTOR_GROUP_GAP_PX,y1:y12+uy3*CONNECTOR_GROUP_GAP_PX,x2:x22-ux3*CONNECTOR_COMPONENT_GAP_PX,y2:y22-uy3*CONNECTOR_COMPONENT_GAP_PX}}function isTooCloseToAnchor(value,anchorValue){return Math.abs(value-anchorValue)<DIMENSION_ANCHOR_CLEARANCE_PX}function createAnchorMarker(x4,y4){return{name:"g",type:"element",attributes:{class:"anchor-offset-marker","data-type":"anchor_offset_marker"},children:[{name:"line",type:"element",attributes:{x1:x4.toString(),y1:(y4-ANCHOR_MARKER_SIZE_PX).toString(),x2:x4.toString(),y2:(y4+ANCHOR_MARKER_SIZE_PX).toString(),stroke:"#ffffff","stroke-width":ANCHOR_MARKER_STROKE_WIDTH_PX.toString(),"stroke-linecap":"round"},children:[],value:""},{name:"line",type:"element",attributes:{x1:(x4-ANCHOR_MARKER_SIZE_PX).toString(),y1:y4.toString(),x2:(x4+ANCHOR_MARKER_SIZE_PX).toString(),y2:y4.toString(),stroke:"#ffffff","stroke-width":ANCHOR_MARKER_STROKE_WIDTH_PX.toString(),"stroke-linecap":"round"},children:[],value:""}],value:""}}function createHorizontalDimension({startX,endX,y:y4,offsetMm,offsetY,displayOffset}){let objects=[];objects.push({name:"line",type:"element",attributes:{x1:startX.toString(),y1:y4.toString(),x2:endX.toString(),y2:y4.toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString(),class:"anchor-offset-dimension-x"},children:[],value:""}),objects.push({name:"line",type:"element",attributes:{x1:startX.toString(),y1:(y4-TICK_SIZE_PX).toString(),x2:startX.toString(),y2:(y4+TICK_SIZE_PX).toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString()},children:[],value:""}),objects.push({name:"line",type:"element",attributes:{x1:endX.toString(),y1:(y4-TICK_SIZE_PX).toString(),x2:endX.toString(),y2:(y4+TICK_SIZE_PX).toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString()},children:[],value:""});let midX=(startX+endX)/2,labelY=offsetY>0?y4-TICK_SIZE_PX-LABEL_GAP_PX:y4+TICK_SIZE_PX+LABEL_GAP_PX;return objects.push({name:"text",type:"element",attributes:{x:midX.toString(),y:labelY.toString(),fill:"#ffffff","font-size":LABEL_FONT_SIZE_PX.toString(),"font-family":"Arial, sans-serif","text-anchor":"middle","dominant-baseline":offsetY>0?"baseline":"hanging",class:"anchor-offset-label"},children:[{type:"text",value:formatOffsetLabel("X",offsetMm,displayOffset),name:"",attributes:{},children:[]}],value:""}),objects}function createVerticalDimension({x:x4,startY,endY,offsetMm,offsetX,displayOffset}){let objects=[];objects.push({name:"line",type:"element",attributes:{x1:x4.toString(),y1:startY.toString(),x2:x4.toString(),y2:endY.toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString(),class:"anchor-offset-dimension-y"},children:[],value:""}),objects.push({name:"line",type:"element",attributes:{x1:(x4-TICK_SIZE_PX).toString(),y1:startY.toString(),x2:(x4+TICK_SIZE_PX).toString(),y2:startY.toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString()},children:[],value:""}),objects.push({name:"line",type:"element",attributes:{x1:(x4-TICK_SIZE_PX).toString(),y1:endY.toString(),x2:(x4+TICK_SIZE_PX).toString(),y2:endY.toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString()},children:[],value:""});let midY=(startY+endY)/2,labelX=offsetX<0?x4-TICK_SIZE_PX-4:x4+TICK_SIZE_PX+4;return objects.push({name:"text",type:"element",attributes:{x:labelX.toString(),y:midY.toString(),fill:"#ffffff","font-size":LABEL_FONT_SIZE_PX.toString(),"font-family":"Arial, sans-serif","text-anchor":offsetX<0?"end":"start","dominant-baseline":"middle",class:"anchor-offset-label"},children:[{type:"text",value:formatOffsetLabel("Y",offsetMm,displayOffset),name:"",attributes:{},children:[]}],value:""}),objects}function formatOffsetLabel(axis,offsetMm,displayOffset){let valueStr=typeof displayOffset=="string"?displayOffset:offsetMm.toFixed(2),unitSuffix=typeof valueStr=="string"&&valueStr.trim().endsWith("mm")?"":"mm";return`${axis}: ${valueStr}${unitSuffix}`}function getPointFromElm(elm){let candidate=elm?.anchor_position??elm?.center;if(candidate&&typeof candidate.x=="number"&&typeof candidate.y=="number")return{x:candidate.x,y:candidate.y}}function createSvgObjectsFromPcbBoard(pcbBoard,ctx){let{transform:transform6,colorMap:colorMap2,showSolderMask,circuitJson}=ctx,{width,height,center:center2,outline,position_mode,anchor_position:boardAnchorPosition,display_offset_x,display_offset_y}=pcbBoard,path;if(outline&&Array.isArray(outline)&&outline.length>=3)path=outline.map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ");else{let halfWidth=width/2,halfHeight=height/2,topLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y-halfHeight]),topRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),bottomRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y+halfHeight]),bottomLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]);path=`M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]}`}path+=" Z";let svgObjects=[];if(showSolderMask){let maskLayer=(ctx.layer??"top")==="bottom"?"soldermask-bottom":"soldermask-top";svgObjects.push({name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board-soldermask",d:path,fill:colorMap2.soldermask.top,"fill-opacity":"0.8",stroke:"none","data-type":"pcb_soldermask","data-pcb-layer":maskLayer}})}if(svgObjects.push({name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:path,fill:"none",stroke:colorMap2.boardOutline,"stroke-width":(.1*Math.abs(transform6.a)).toString(),"data-type":"pcb_board","data-pcb-layer":"board"}}),ctx.showAnchorOffsets&&circuitJson&&position_mode==="relative_to_panel_anchor"){let panel=circuitJson.find(elm=>elm.type==="pcb_panel");if(panel){let panelAnchorPosition=getPointFromElm(panel);panelAnchorPosition&&svgObjects.push(...createAnchorOffsetIndicators({groupAnchorPosition:panelAnchorPosition,componentPosition:boardAnchorPosition??center2,transform:transform6,componentWidth:width,componentHeight:height,displayXOffset:display_offset_x,displayYOffset:display_offset_y}))}}return svgObjects}function createSvgObjectsFromPcbPanel(pcbPanel,ctx){let{transform:transform6,colorMap:colorMap2,showSolderMask}=ctx,width=Number(pcbPanel.width),height=Number(pcbPanel.height),center2=pcbPanel.center??{x:width/2,y:height/2},halfWidth=width/2,halfHeight=height/2,topLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y-halfHeight]),topRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),bottomRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y+halfHeight]),bottomLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]),path=`M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]} Z`,isCoveredWithSolderMask=pcbPanel.covered_with_solder_mask!==!1,shouldShowSolderMask=!!(showSolderMask&&isCoveredWithSolderMask);return[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-panel",d:path,fill:"none",stroke:colorMap2.boardOutline,"stroke-width":(.1*Math.abs(transform6.a)).toString(),"data-type":"pcb_panel","data-pcb-layer":"board"}}]}function createSvgObjectsFromPcbVia(hole,ctx){let{transform:transform6,colorMap:colorMap2}=ctx,[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]),scaledOuterWidth=hole.outer_diameter*Math.abs(transform6.a),scaledOuterHeight=hole.outer_diameter*Math.abs(transform6.a),scaledHoleWidth=hole.hole_diameter*Math.abs(transform6.a),scaledHoleHeight=hole.hole_diameter*Math.abs(transform6.a),outerRadius=Math.min(scaledOuterWidth,scaledOuterHeight)/2,innerRadius=Math.min(scaledHoleWidth,scaledHoleHeight)/2;return{name:"g",type:"element",attributes:{"data-type":"pcb_via","data-pcb-layer":"through"},children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:colorMap2.copper.top,cx:x4.toString(),cy:y4.toString(),r:outerRadius.toString(),"data-type":"pcb_via","data-pcb-layer":"top"}},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,cx:x4.toString(),cy:y4.toString(),r:innerRadius.toString(),"data-type":"pcb_via","data-pcb-layer":"drill"}}]}}function createSvgObjectsFromPcbHole(hole,ctx){let{transform:transform6,colorMap:colorMap2,showSolderMask}=ctx,layer=ctx.layer??"top",[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]),isCoveredWithSolderMask=!!hole.is_covered_with_solder_mask,soldermaskMargin=(hole.soldermask_margin??0)*Math.abs(transform6.a),shouldShowSolderMask=showSolderMask&&isCoveredWithSolderMask&&soldermaskMargin!==0,solderMaskColor=colorMap2.soldermask.top;if(hole.hole_shape==="circle"||hole.hole_shape==="square"){let scaledDiameter=hole.hole_diameter*Math.abs(transform6.a),radius=scaledDiameter/2;if(hole.hole_shape==="circle"){let holeElement2={name:"circle",type:"element",attributes:{class:"pcb-hole",cx:x4.toString(),cy:y4.toString(),r:radius.toString(),fill:colorMap2.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement2];let maskRadius=radius+soldermaskMargin;if(soldermaskMargin<0){let coveredElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement2]}let holeElement={name:"rect",type:"element",attributes:{class:"pcb-hole",x:(x4-radius).toString(),y:(y4-radius).toString(),width:scaledDiameter.toString(),height:scaledDiameter.toString(),fill:colorMap2.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskDiameter=scaledDiameter+2*soldermaskMargin;if(soldermaskMargin<0){let coveredElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,x:(x4-radius).toString(),y:(y4-radius).toString(),width:scaledDiameter.toString(),height:scaledDiameter.toString(),"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,x:(x4-maskDiameter/2).toString(),y:(y4-maskDiameter/2).toString(),width:maskDiameter.toString(),height:maskDiameter.toString(),"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(x4-maskDiameter/2).toString(),y:(y4-maskDiameter/2).toString(),width:maskDiameter.toString(),height:maskDiameter.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}if(hole.hole_shape==="oval"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),rx3=scaledWidth/2,ry3=scaledHeight/2,holeElement={name:"ellipse",type:"element",attributes:{class:"pcb-hole",cx:x4.toString(),cy:y4.toString(),rx:rx3.toString(),ry:ry3.toString(),fill:colorMap2.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskRx=rx3+soldermaskMargin,maskRy=ry3+soldermaskMargin;if(soldermaskMargin<0){let coveredElement={name:"ellipse",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,cx:x4.toString(),cy:y4.toString(),rx:rx3.toString(),ry:ry3.toString(),"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"ellipse",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,cx:x4.toString(),cy:y4.toString(),rx:maskRx.toString(),ry:maskRy.toString(),"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"ellipse",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,cx:x4.toString(),cy:y4.toString(),rx:maskRx.toString(),ry:maskRy.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}if(hole.hole_shape==="rect"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),holeElement={name:"rect",type:"element",attributes:{class:"pcb-hole",x:(x4-scaledWidth/2).toString(),y:(y4-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),fill:colorMap2.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskWidth=scaledWidth+2*soldermaskMargin,maskHeight=scaledHeight+2*soldermaskMargin;if(soldermaskMargin<0){let coveredElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,x:(x4-scaledWidth/2).toString(),y:(y4-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,x:(x4-maskWidth/2).toString(),y:(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(x4-maskWidth/2).toString(),y:(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}if(hole.hole_shape==="pill"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),isHorizontal3=scaledWidth>scaledHeight,radius=Math.min(scaledWidth,scaledHeight)/2,straightLength=Math.abs(isHorizontal3?scaledWidth-scaledHeight:scaledHeight-scaledWidth),pathD=isHorizontal3?`M${x4-straightLength/2},${y4-radius} h${straightLength} a${radius},${radius} 0 0 1 0,${scaledHeight} h-${straightLength} a${radius},${radius} 0 0 1 0,-${scaledHeight} z`:`M${x4-radius},${y4-straightLength/2} v${straightLength} a${radius},${radius} 0 0 0 ${scaledWidth},0 v-${straightLength} a${radius},${radius} 0 0 0 -${scaledWidth},0 z`,holeElement={name:"path",type:"element",attributes:{class:"pcb-hole",fill:colorMap2.drill,d:pathD,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskWidth=scaledWidth+2*soldermaskMargin,maskHeight=scaledHeight+2*soldermaskMargin,maskIsHorizontal=maskWidth>maskHeight,maskRadius=Math.min(maskWidth,maskHeight)/2,maskStraightLength=Math.abs(maskIsHorizontal?maskWidth-maskHeight:maskHeight-maskWidth),maskPathD=maskIsHorizontal?`M${x4-maskStraightLength/2},${y4-maskRadius} h${maskStraightLength} a${maskRadius},${maskRadius} 0 0 1 0,${maskHeight} h-${maskStraightLength} a${maskRadius},${maskRadius} 0 0 1 0,-${maskHeight} z`:`M${x4-maskRadius},${y4-maskStraightLength/2} v${maskStraightLength} a${maskRadius},${maskRadius} 0 0 0 ${maskWidth},0 v-${maskStraightLength} a${maskRadius},${maskRadius} 0 0 0 -${maskWidth},0 z`;if(soldermaskMargin<0){let coveredElement={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,d:pathD,"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,d:maskPathD,"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,d:maskPathD,"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}if(hole.hole_shape==="rotated_pill"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),rotation5="ccw_rotation"in hole?hole.ccw_rotation??0:0,isHorizontal3=scaledWidth>scaledHeight,radius=Math.min(scaledWidth,scaledHeight)/2,straightLength=Math.abs(isHorizontal3?scaledWidth-scaledHeight:scaledHeight-scaledWidth),pathD=isHorizontal3?`M${-straightLength/2},${-radius} h${straightLength} a${radius},${radius} 0 0 1 0,${scaledHeight} h-${straightLength} a${radius},${radius} 0 0 1 0,-${scaledHeight} z`:`M${-radius},${-straightLength/2} v${straightLength} a${radius},${radius} 0 0 0 ${scaledWidth},0 v-${straightLength} a${radius},${radius} 0 0 0 -${scaledWidth},0 z`,holeElement={name:"path",type:"element",attributes:{class:"pcb-hole",fill:colorMap2.drill,d:pathD,transform:`translate(${x4} ${y4}) rotate(${-rotation5})`,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskWidth=scaledWidth+2*soldermaskMargin,maskHeight=scaledHeight+2*soldermaskMargin,maskIsHorizontal=maskWidth>maskHeight,maskRadius=Math.min(maskWidth,maskHeight)/2,maskStraightLength=Math.abs(maskIsHorizontal?maskWidth-maskHeight:maskHeight-maskWidth),maskPathD=maskIsHorizontal?`M${-maskStraightLength/2},${-maskRadius} h${maskStraightLength} a${maskRadius},${maskRadius} 0 0 1 0,${maskHeight} h-${maskStraightLength} a${maskRadius},${maskRadius} 0 0 1 0,-${maskHeight} z`:`M${-maskRadius},${-maskStraightLength/2} v${maskStraightLength} a${maskRadius},${maskRadius} 0 0 0 ${maskWidth},0 v-${maskStraightLength} a${maskRadius},${maskRadius} 0 0 0 -${maskWidth},0 z`;if(soldermaskMargin<0){let coveredElement={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,d:pathD,transform:`translate(${x4} ${y4}) rotate(${-rotation5})`,"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,d:maskPathD,transform:`translate(${x4} ${y4}) rotate(${-rotation5})`,"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,d:maskPathD,"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}return[]}function createSvgObjectsForRatsNest(circuitJson,ctx){let{transform:transform6}=ctx,connectivity=getFullConnectivityMapFromCircuitJson(circuitJson),pcbPorts=circuitJson.filter(elm=>elm.type==="pcb_port"),sourceTraces=circuitJson.filter(elm=>elm.type==="source_trace"),ratsNestLines=[];pcbPorts.forEach((port,index)=>{let portId=port.pcb_port_id;if(!portId)return;let netId=connectivity.getNetConnectedToId(portId);if(!netId)return;let isInNet=!1,sourcePort=su2(circuitJson).source_port.getWhere({pcb_port_id:portId});if(sourcePort&&sourcePort.source_port_id){let sourcePortId=sourcePort.source_port_id;for(let trace of sourceTraces)if(Array.isArray(trace.connected_source_port_ids)&&trace.connected_source_port_ids.includes(sourcePortId)&&Array.isArray(trace.connected_source_net_ids)&&trace.connected_source_net_ids.length>0){isInNet=!0;break}}let startPoint={x:port.x,y:port.y},nearestPoint=findNearestPointInNet(startPoint,netId,connectivity,circuitJson);nearestPoint&&ratsNestLines.push({key:`${portId}-${index}`,startPoint,endPoint:nearestPoint,isInNet})});let svgObjects=[];for(let line2 of ratsNestLines){let transformedStart=applyToPoint3(transform6,[line2.startPoint.x,line2.startPoint.y]),transformedEnd=applyToPoint3(transform6,[line2.endPoint.x,line2.endPoint.y]),attributes2={x1:transformedStart[0].toString(),y1:transformedStart[1].toString(),x2:transformedEnd[0].toString(),y2:transformedEnd[1].toString(),stroke:"white","stroke-width":"1","stroke-dasharray":"6,6","data-type":"pcb_rats_nest","data-pcb-layer":"overlay"};svgObjects.push({name:"line",type:"element",attributes:attributes2,value:"",children:[]})}return svgObjects}function createSvgObjectsFromPcbCutout(cutout,ctx){let{transform:transform6,colorMap:colorMap2}=ctx;if(cutout.shape==="rect"){let rectCutout=cutout,[cx3,cy3]=applyToPoint3(transform6,[rectCutout.center.x,rectCutout.center.y]),scaledWidth=rectCutout.width*Math.abs(transform6.a),scaledHeight=rectCutout.height*Math.abs(transform6.d),svgRotation=-(rectCutout.rotation??0),{corner_radius}=rectCutout,baseCornerRadius=typeof corner_radius=="number"&&corner_radius>0?corner_radius:0,transformedCornerRadiusX=baseCornerRadius*Math.abs(transform6.a),transformedCornerRadiusY=baseCornerRadius*Math.abs(transform6.d),attributes2={class:"pcb-cutout pcb-cutout-rect",x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),fill:colorMap2.drill,transform:toString(compose3(translate3(cx3,cy3),rotate3(svgRotation*Math.PI/180))),"data-type":"pcb_cutout","data-pcb-layer":"drill"};return transformedCornerRadiusX>0&&(attributes2.rx=transformedCornerRadiusX.toString()),transformedCornerRadiusY>0&&(attributes2.ry=transformedCornerRadiusY.toString()),[{name:"rect",type:"element",attributes:attributes2,children:[],value:""}]}if(cutout.shape==="circle"){let circleCutout=cutout,[cx3,cy3]=applyToPoint3(transform6,[circleCutout.center.x,circleCutout.center.y]),scaledRadius=circleCutout.radius*Math.abs(transform6.a);return[{name:"circle",type:"element",attributes:{class:"pcb-cutout pcb-cutout-circle",cx:cx3.toString(),cy:cy3.toString(),r:scaledRadius.toString(),fill:colorMap2.drill,"data-type":"pcb_cutout","data-pcb-layer":"drill"},children:[],value:""}]}if(cutout.shape==="polygon"){let polygonCutout=cutout;return!polygonCutout.points||polygonCutout.points.length===0?[]:[{name:"polygon",type:"element",attributes:{class:"pcb-cutout pcb-cutout-polygon",points:polygonCutout.points.map(p4=>applyToPoint3(transform6,[p4.x,p4.y])).map(p4=>`${p4[0]},${p4[1]}`).join(" "),fill:colorMap2.drill,"data-type":"pcb_cutout","data-pcb-layer":"drill"},children:[],value:""}]}return[]}function createSvgObjectsFromPcbCutoutPath(cutoutPath,ctx){let{transform:transform6,colorMap:colorMap2}=ctx;if(!cutoutPath.route||!Array.isArray(cutoutPath.route))return[];let firstPoint=cutoutPath.route[0],lastPoint=cutoutPath.route[cutoutPath.route.length-1],isClosed=firstPoint&&lastPoint&&firstPoint.x===lastPoint.x&&firstPoint.y===lastPoint.y;return[{name:"path",type:"element",attributes:{class:"pcb-cutout pcb-cutout-path",d:cutoutPath.route.slice(0,isClosed?-1:void 0).map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ")+(isClosed?" Z":""),fill:colorMap2.drill,"data-type":"pcb_cutout_path","data-pcb-cutout-id":cutoutPath.pcb_cutout_id,"data-pcb-layer":"drill"},value:"",children:[]}]}function createKeepoutPatternLines(keepoutColor){let patternLines=[];for(let i3=-KEEPOUT_PATTERN_SIZE;i3<=KEEPOUT_PATTERN_SIZE;i3+=KEEPOUT_LINE_SPACING)patternLines.push({name:"line",type:"element",value:"",attributes:{x1:i3.toString(),y1:"0",x2:(i3+KEEPOUT_PATTERN_SIZE).toString(),y2:KEEPOUT_PATTERN_SIZE.toString(),stroke:keepoutColor,"stroke-width":"1"},children:[]});return patternLines}function createKeepoutPatternDefs(keepoutColor){return{name:"defs",type:"element",value:"",attributes:{},children:[{name:"pattern",type:"element",value:"",attributes:{id:KEEPOUT_PATTERN_ID,width:KEEPOUT_PATTERN_SIZE.toString(),height:KEEPOUT_PATTERN_SIZE.toString(),patternUnits:"userSpaceOnUse"},children:createKeepoutPatternLines(keepoutColor)}]}}function createKeepoutBaseAttributes(keepoutId,layer,shapeClass,description){let attributes2={class:`pcb-keepout ${shapeClass} pcb-keepout-background`,"data-type":"pcb_keepout","data-pcb-layer":layer,"data-pcb-keepout-id":keepoutId,stroke:"none"};return description&&(attributes2["data-description"]=description),attributes2}function createKeepoutPatternAttributes(keepoutId,layer,shapeClass,description){let attributes2={class:`pcb-keepout ${shapeClass} pcb-keepout-pattern`,fill:`url(#${KEEPOUT_PATTERN_ID})`,"data-type":"pcb_keepout","data-pcb-layer":layer,"data-pcb-keepout-id":keepoutId,stroke:"none"};return description&&(attributes2["data-description"]=description),attributes2}function createSvgObjectsFromPcbKeepout(keepout,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx;if(layerFilter&&!keepout.layers.includes(layerFilter))return[];let svgObjects=[],keepoutColor=colorMap2.keepout;for(let layer of keepout.layers)if(!(layerFilter&&layer!==layerFilter)){if(keepout.shape==="rect"){let rectKeepout=keepout,[cx3,cy3]=applyToPoint3(transform6,[rectKeepout.center.x,rectKeepout.center.y]),scaledWidth=rectKeepout.width*Math.abs(transform6.a),scaledHeight=rectKeepout.height*Math.abs(transform6.d),baseTransform=toString(compose3(translate3(cx3,cy3))),backgroundAttributes={...createKeepoutBaseAttributes(rectKeepout.pcb_keepout_id,layer,"pcb-keepout-rect",rectKeepout.description),x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),fill:KEEPOUT_BACKGROUND_COLOR,transform:baseTransform},patternAttributes={...createKeepoutPatternAttributes(rectKeepout.pcb_keepout_id,layer,"pcb-keepout-rect",rectKeepout.description),x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),transform:baseTransform};svgObjects.push({name:"rect",type:"element",attributes:backgroundAttributes,children:[],value:""},{name:"rect",type:"element",attributes:patternAttributes,children:[],value:""})}else if(keepout.shape==="circle"){let circleKeepout=keepout,[cx3,cy3]=applyToPoint3(transform6,[circleKeepout.center.x,circleKeepout.center.y]),scaledRadius=circleKeepout.radius*Math.abs(transform6.a),backgroundAttributes={...createKeepoutBaseAttributes(circleKeepout.pcb_keepout_id,layer,"pcb-keepout-circle",circleKeepout.description),cx:cx3.toString(),cy:cy3.toString(),r:scaledRadius.toString(),fill:KEEPOUT_BACKGROUND_COLOR},patternAttributes={...createKeepoutPatternAttributes(circleKeepout.pcb_keepout_id,layer,"pcb-keepout-circle",circleKeepout.description),cx:cx3.toString(),cy:cy3.toString(),r:scaledRadius.toString()};svgObjects.push({name:"circle",type:"element",attributes:backgroundAttributes,children:[],value:""},{name:"circle",type:"element",attributes:patternAttributes,children:[],value:""})}}return svgObjects}function ringToPathD(vertices,transform6){if(vertices.length===0)return"";let transformedVertices=vertices.map(v4=>{let[x4,y4]=applyToPoint3(transform6,[v4.x,v4.y]);return{...v4,x:x4,y:y4}}),d4=`M ${transformedVertices[0].x} ${transformedVertices[0].y}`;for(let i3=0;i3<transformedVertices.length;i3++){let start=transformedVertices[i3],end=transformedVertices[(i3+1)%transformedVertices.length];if(start.bulge){if(Math.hypot(end.x-start.x,end.y-start.y)<1e-9)continue;let bulge=start.bulge,dx3=end.x-start.x,dy3=end.y-start.y,dist=Math.hypot(dx3,dy3),radius=Math.abs(dist/4/bulge*(bulge*bulge+1)),sweepFlag=bulge<0?1:0,largeArcFlag=Math.abs(bulge)>1?1:0;d4+=` A ${radius} ${radius} 0 ${largeArcFlag} ${sweepFlag} ${end.x} ${end.y}`}else d4+=` L ${end.x} ${end.y}`}return d4+=" Z",d4}function createSoldermaskCutoutElement({elementType,shapeAttributes,layer,colorMap:colorMap2,additionalAttributes}){let baseAttributes={class:"pcb-soldermask-cutout",fill:colorMap2.substrate,"data-type":"pcb_soldermask_opening","data-pcb-layer":layer,...shapeAttributes,...additionalAttributes};return{name:elementType,type:"element",value:"",children:[],attributes:baseAttributes}}function createSoldermaskOverlayElement({elementType,shapeAttributes,layer,fillColor,fillOpacity,className,additionalAttributes}){let baseAttributes={class:className,fill:fillColor,"fill-opacity":fillOpacity,"data-type":"pcb_soldermask","data-pcb-layer":layer,...shapeAttributes,...additionalAttributes};return{name:elementType,type:"element",value:"",children:[],attributes:baseAttributes}}function createSvgObjectsFromPcbCopperPour(pour,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2,showSolderMask}=ctx,{layer}=pour;if(layerFilter&&layer!==layerFilter)return[];let color=layerNameToColor(layer,colorMap2),opacity="0.5",isCoveredWithSolderMask=pour.covered_with_solder_mask!==!1,maskOverlayColor=layer==="bottom"?colorMap2.soldermaskOverCopper.bottom:colorMap2.soldermaskOverCopper.top,maskOverlayOpacity="0.9";if(pour.shape==="rect"){let[cx3,cy3]=applyToPoint3(transform6,[pour.center.x,pour.center.y]),scaledWidth=pour.width*Math.abs(transform6.a),scaledHeight=pour.height*Math.abs(transform6.d),svgRotation=-(pour.rotation??0),rectAttributes={x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),transform:toString(compose3(translate3(cx3,cy3),rotate3(svgRotation*Math.PI/180)))},copperRect={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-copper-pour pcb-copper-pour-rect",...rectAttributes,fill:color,"fill-opacity":opacity,"data-type":"pcb_copper_pour","data-pcb-layer":layer}},maskRect=showSolderMask?isCoveredWithSolderMask?createSoldermaskOverlayElement({elementType:"rect",shapeAttributes:rectAttributes,layer,fillColor:maskOverlayColor,fillOpacity:maskOverlayOpacity,className:"pcb-soldermask-covered-pour"}):createSoldermaskCutoutElement({elementType:"rect",shapeAttributes:rectAttributes,layer,colorMap:colorMap2}):null;return maskRect?!isCoveredWithSolderMask&&pour.pcb_copper_pour_id?.includes("substrate_only")?[maskRect]:[copperRect,maskRect]:[copperRect]}if(pour.shape==="polygon"){if(!pour.points||pour.points.length===0)return[];let pointsString=pour.points.map(p4=>applyToPoint3(transform6,[p4.x,p4.y])).map(p4=>`${p4[0]},${p4[1]}`).join(" "),copperPolygon={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-copper-pour pcb-copper-pour-polygon",points:pointsString,fill:color,"fill-opacity":opacity,"data-type":"pcb_copper_pour","data-pcb-layer":layer}},maskPolygon=showSolderMask?isCoveredWithSolderMask?createSoldermaskOverlayElement({elementType:"polygon",shapeAttributes:{points:pointsString},layer,fillColor:maskOverlayColor,fillOpacity:maskOverlayOpacity,className:"pcb-soldermask-covered-pour"}):createSoldermaskCutoutElement({elementType:"polygon",shapeAttributes:{points:pointsString},layer,colorMap:colorMap2}):null;return maskPolygon?!isCoveredWithSolderMask&&pour.pcb_copper_pour_id?.includes("substrate_only")?[maskPolygon]:[copperPolygon,maskPolygon]:[copperPolygon]}if(pour.shape==="brep"){let{brep_shape:brep_shape3}=pour,d4=ringToPathD(brep_shape3.outer_ring.vertices,transform6);for(let inner_ring of brep_shape3.inner_rings??[])d4+=` ${ringToPathD(inner_ring.vertices,transform6)}`;let copperPath={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-copper-pour pcb-copper-pour-brep",d:d4,fill:color,"fill-rule":"evenodd","fill-opacity":opacity,"data-type":"pcb_copper_pour","data-pcb-layer":layer}},maskPath=showSolderMask?isCoveredWithSolderMask?createSoldermaskOverlayElement({elementType:"path",shapeAttributes:{d:d4,"fill-rule":"evenodd"},layer,fillColor:maskOverlayColor,fillOpacity:maskOverlayOpacity,className:"pcb-soldermask-covered-pour"}):createSoldermaskCutoutElement({elementType:"path",shapeAttributes:{d:d4,"fill-rule":"evenodd"},layer,colorMap:colorMap2}):null;return maskPath?!isCoveredWithSolderMask&&pour.pcb_copper_pour_id?.includes("substrate_only")?[maskPath]:[copperPath,maskPath]:[copperPath]}return[]}function createSvgObjectsForPcbGrid({grid:grid4,svgWidth,svgHeight}){if(!grid4)return{};let gridLineColor=grid4.lineColor??DEFAULT_GRID_LINE_COLOR,gridCellSize=grid4.cellSize,majorCellSize=grid4.majorCellSize,majorLineColor=grid4.majorLineColor??gridLineColor;if(majorCellSize!==void 0){if(!gridCellSize||gridCellSize<=0)throw new Error("grid.majorCellSize requires a positive grid.cellSize");if(majorCellSize<=0)throw new Error("grid.majorCellSize must be a positive multiple of grid.cellSize");let ratio=majorCellSize/gridCellSize,nearestInteger=Math.round(ratio);if(!Number.isFinite(ratio)||Math.abs(ratio-nearestInteger)>1e-6)throw new Error("grid.majorCellSize must be a positive multiple of grid.cellSize")}if(!gridCellSize||gridCellSize<=0)return{};let hasMajorGrid=majorCellSize!==void 0,patternChildren=hasMajorGrid?createMajorGridPatternChildren(gridCellSize,majorCellSize,gridLineColor,majorLineColor):[{name:"path",type:"element",value:"",attributes:{d:`M ${gridCellSize} 0 L 0 0 0 ${gridCellSize}`,fill:"none",stroke:gridLineColor,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]}],defs={name:"defs",type:"element",value:"",attributes:{},children:[{name:"pattern",type:"element",value:"",attributes:{id:GRID_PATTERN_ID,width:hasMajorGrid?majorCellSize.toString():gridCellSize.toString(),height:hasMajorGrid?majorCellSize.toString():gridCellSize.toString(),patternUnits:"userSpaceOnUse"},children:patternChildren}]},rect={name:"rect",type:"element",value:"",attributes:{x:"0",y:"0",width:svgWidth.toString(),height:svgHeight.toString(),fill:`url(#${GRID_PATTERN_ID})`,"pointer-events":"none","data-type":"pcb_grid","data-pcb-layer":"global"},children:[]};return{defs,rect}}function createMajorGridPatternChildren(cellSize,majorCellSize,lineColor,majorLineColor){let children=[],steps=Math.round(majorCellSize/cellSize);for(let step=0;step<steps;step+=1){let offsetString=Number((step*cellSize).toFixed(6)).toString(),color=step===0?majorLineColor:lineColor,majorSizeString=majorCellSize.toString();children.push({name:"line",type:"element",value:"",attributes:{x1:offsetString,y1:"0",x2:offsetString,y2:majorSizeString,stroke:color,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]}),children.push({name:"line",type:"element",value:"",attributes:{x1:"0",y1:offsetString,x2:majorSizeString,y2:offsetString,stroke:color,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]})}return children}function createSvgObjectsFromPcbComponent(component,ctx){let{transform:transform6,circuitJson}=ctx,{center:center2,width,height,rotation:rotation5=0}=component,[x4,y4]=applyToPoint3(transform6,[center2.x,center2.y]),scaledWidth=width*Math.abs(transform6.a),scaledHeight=height*Math.abs(transform6.d),transformStr=`translate(${x4}, ${y4}) rotate(${-rotation5}) scale(1, -1)`,svgObjects=[];if(ctx.showAnchorOffsets&&circuitJson&&component.position_mode==="relative_to_group_anchor"&&(component.positioned_relative_to_pcb_group_id||component.positioned_relative_to_pcb_board_id)){let parentAnchorPosition=getParentAnchorPosition(component,circuitJson);parentAnchorPosition&&svgObjects.push(...createAnchorOffsetIndicators({groupAnchorPosition:parentAnchorPosition,componentPosition:center2,transform:transform6,componentWidth:width,componentHeight:height,displayXOffset:component.display_offset_x,displayYOffset:component.display_offset_y}))}return!ctx.colorMap.debugComponent?.fill&&!ctx.colorMap.debugComponent?.stroke||svgObjects.push({name:"g",type:"element",attributes:{transform:transformStr,"data-type":"pcb_component","data-pcb-layer":component.layer??"top"},children:[{name:"rect",type:"element",attributes:{class:"pcb-component",x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),fill:ctx.colorMap.debugComponent.fill??"transparent",stroke:ctx.colorMap.debugComponent.stroke??"transparent","data-type":"pcb_component","data-pcb-layer":component.layer??"top"}}],value:""}),svgObjects}function getParentAnchorPosition(component,circuitJson){if(component.positioned_relative_to_pcb_group_id){let pcbGroup=circuitJson.find(elm=>elm.type==="pcb_group"&&elm.pcb_group_id===component.positioned_relative_to_pcb_group_id),point7=getPointFromElm(pcbGroup);if(point7)return point7}if(component.positioned_relative_to_pcb_board_id){let pcbBoard=circuitJson.find(elm=>elm.type==="pcb_board"&&elm.pcb_board_id===component.positioned_relative_to_pcb_board_id),point7=getPointFromElm(pcbBoard);if(point7)return point7}}function createSvgObjectsFromPcbGroup(pcbGroup,ctx){let{transform:transform6,circuitJson}=ctx,{center:center2,width,height}=pcbGroup,svgObjects=[];if(ctx.showAnchorOffsets&&pcbGroup.position_mode==="relative_to_group_anchor"&&circuitJson){let parentAnchorPosition=getParentAnchorPosition2(pcbGroup,circuitJson);parentAnchorPosition&&svgObjects.push(...createAnchorOffsetIndicators({groupAnchorPosition:parentAnchorPosition,componentPosition:pcbGroup.anchor_position??pcbGroup.center,transform:transform6,componentWidth:pcbGroup.width,componentHeight:pcbGroup.height,displayXOffset:pcbGroup.display_offset_x,displayYOffset:pcbGroup.display_offset_y}))}let outline=Array.isArray(pcbGroup.outline)?pcbGroup.outline:void 0,transformedStrokeWidth=DEFAULT_STROKE_WIDTH*Math.abs(transform6.a),dashLength=.3*Math.abs(transform6.a),gapLength=.15*Math.abs(transform6.a),baseAttributes={class:"pcb-group",fill:"none",stroke:getGroupColor(pcbGroup.pcb_group_id),"stroke-width":transformedStrokeWidth.toString(),"stroke-dasharray":`${dashLength} ${gapLength}`,"data-type":"pcb_group","data-pcb-group-id":pcbGroup.pcb_group_id,"data-pcb-layer":"overlay"};if(pcbGroup.name&&(baseAttributes["data-group-name"]=pcbGroup.name),outline&&outline.length>=3&&outline.every(point7=>point7&&typeof point7.x=="number"&&typeof point7.y=="number")){let path=outline.map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ");return svgObjects.push({name:"path",type:"element",value:"",children:[],attributes:{...baseAttributes,d:`${path} Z`}}),svgObjects}if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof width!="number"||typeof height!="number")return debugPcb(`[pcb_group] Invalid data for "${pcbGroup.pcb_group_id}"${pcbGroup.name?` (name: "${pcbGroup.name}")`:""}: expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center2)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`),svgObjects;let halfWidth=width/2,halfHeight=height/2,[topLeftX,topLeftY]=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]),[bottomRightX,bottomRightY]=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),rectX=Math.min(topLeftX,bottomRightX),rectY=Math.min(topLeftY,bottomRightY),rectWidth=Math.abs(bottomRightX-topLeftX),rectHeight=Math.abs(bottomRightY-topLeftY),svgObject={name:"rect",type:"element",value:"",attributes:{...baseAttributes,x:rectX.toString(),y:rectY.toString(),width:rectWidth.toString(),height:rectHeight.toString()},children:[]};return svgObjects.push(svgObject),svgObjects}function getGroupColor(pcbGroupId){let match2=pcbGroupId.match(/(\d+)$/),index=match2?Number.parseInt(match2[1],10):0;return GROUP_COLOR_PALETTE[index%GROUP_COLOR_PALETTE.length]}function getParentAnchorPosition2(group,circuitJson){if(group.positioned_relative_to_pcb_group_id){let pcbGroup=circuitJson.find(elm=>elm.type==="pcb_group"&&elm.pcb_group_id===group.positioned_relative_to_pcb_group_id),point7=getPointFromElm(pcbGroup);if(point7)return point7}if(group.positioned_relative_to_pcb_board_id){let pcbBoard=circuitJson.find(elm=>elm.type==="pcb_board"&&elm.pcb_board_id===group.positioned_relative_to_pcb_board_id),point7=getPointFromElm(pcbBoard);if(point7)return point7}}function getSoftwareUsedString(circuitJson){return circuitJson.find(e5=>e5.type==="project_software_metadata"||e5.type==="source_project_metadata")?.software_used_string}function sortSvgObjectsByPcbLayer(objects){return objects.map((object,index)=>({object,index,layerPriority:getLayerPriority(object.attributes?.["data-pcb-layer"]??void 0),typePriority:getTypePriority(object.attributes?.["data-type"]??void 0)})).sort((a3,b3)=>a3.layerPriority!==b3.layerPriority?a3.layerPriority-b3.layerPriority:a3.typePriority!==b3.typePriority?a3.typePriority-b3.typePriority:a3.index-b3.index).map(({object})=>object)}function getLayerPriority(layer){if(!layer)return 500;let normalized=layer.toLowerCase();if(normalized==="global")return-100;if(normalized==="bottom")return 4;if(normalized==="board")return 2;if(normalized==="soldermask-top"||normalized==="soldermask-bottom")return 3;if(normalized.startsWith("inner")){let match2=normalized.match(/\d+/);return 5+(match2?Number.parseInt(match2[0],10):0)}return normalized==="through"?18:normalized==="top"?17:normalized==="drill"?30:normalized==="overlay"?40:10}function getTypePriority(type){return type?TYPE_PRIORITY[type]??DEFAULT_TYPE_PRIORITY:DEFAULT_TYPE_PRIORITY}function createErrorTextOverlay(circuitJson,dataType="error_text_overlay"){let errorElms=circuitJson.filter(elm=>elm.type.endsWith("_error"));if(errorElms.length===0)return null;let errorMessages=errorElms.map(e5=>e5.message).filter(m4=>!!m4);return errorMessages.length===0?null:{name:"text",type:"element",value:"",attributes:{x:"10",y:"20",fill:"red","font-family":"monospace","font-size":"12px","data-type":dataType,"data-layer":"global"},children:errorMessages.map((msg,i3)=>({name:"tspan",type:"element",value:"",attributes:{x:"10",dy:i3===0?"0":"1.2em"},children:[{type:"text",value:msg,name:"",attributes:{},children:[]}]}))}}function getPcbBoundsFromCircuitJson(circuitJson){let minX=Number.POSITIVE_INFINITY,minY=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY,hasBounds2=!1,boardMinX=Number.POSITIVE_INFINITY,boardMinY=Number.POSITIVE_INFINITY,boardMaxX=Number.NEGATIVE_INFINITY,boardMaxY=Number.NEGATIVE_INFINITY,hasBoardBounds=!1;for(let circuitJsonElm of circuitJson)if(circuitJsonElm.type==="pcb_panel"){let panel=circuitJsonElm,width=distance.parse(panel.width),height=distance.parse(panel.height);if(width===void 0||height===void 0)continue;let center2=panel.center??{x:width/2,y:height/2};updateBounds({center:center2,width,height})}else if(circuitJsonElm.type==="pcb_board")circuitJsonElm.outline&&Array.isArray(circuitJsonElm.outline)&&circuitJsonElm.outline.length>=3?(updateBoundsToIncludeOutline(circuitJsonElm.outline),updateBoardBoundsToIncludeOutline(circuitJsonElm.outline)):"center"in circuitJsonElm&&"width"in circuitJsonElm&&"height"in circuitJsonElm&&(updateBounds({center:circuitJsonElm.center,width:circuitJsonElm.width,height:circuitJsonElm.height}),updateBoardBounds({center:circuitJsonElm.center,width:circuitJsonElm.width,height:circuitJsonElm.height}));else if(circuitJsonElm.type==="pcb_smtpad"){let pad2=circuitJsonElm;if(pad2.shape==="rect"||pad2.shape==="rotated_rect"||pad2.shape==="pill")updateBounds({center:{x:pad2.x,y:pad2.y},width:pad2.width,height:pad2.height});else if(pad2.shape==="circle"){let radius=distance.parse(pad2.radius);radius!==void 0&&updateBounds({center:{x:pad2.x,y:pad2.y},width:radius*2,height:radius*2})}else pad2.shape==="polygon"&&updateTraceBounds(pad2.points)}else if("x"in circuitJsonElm&&"y"in circuitJsonElm)updateBounds({center:{x:circuitJsonElm.x,y:circuitJsonElm.y},width:0,height:0});else if("route"in circuitJsonElm)updateTraceBounds(circuitJsonElm.route);else if(circuitJsonElm.type==="pcb_note_rect"||circuitJsonElm.type==="pcb_fabrication_note_rect")updateBounds({center:circuitJsonElm.center,width:circuitJsonElm.width,height:circuitJsonElm.height});else if(circuitJsonElm.type==="pcb_note_dimension"||circuitJsonElm.type==="pcb_fabrication_note_dimension"){let dimension=circuitJsonElm,{from,to:to3,text,font_size=1,arrow_size,offset_distance,offset_direction}=dimension;if(!from||!to3||!arrow_size)continue;updateBounds({center:from,width:0,height:0}),updateBounds({center:to3,width:0,height:0});let normalize3=v4=>{let l4=Math.hypot(v4.x,v4.y)||1;return{x:v4.x/l4,y:v4.y/l4}},direction2=normalize3({x:to3.x-from.x,y:to3.y-from.y});if(Number.isNaN(direction2.x)||Number.isNaN(direction2.y))continue;let perpendicular={x:-direction2.y,y:direction2.x},hasOffsetDirection=offset_direction&&typeof offset_direction.x=="number"&&typeof offset_direction.y=="number",normalizedOffsetDirection=hasOffsetDirection?normalize3(offset_direction):{x:0,y:0},offsetMagnitude=typeof offset_distance=="number"?offset_distance:0,offsetVector={x:normalizedOffsetDirection.x*offsetMagnitude,y:normalizedOffsetDirection.y*offsetMagnitude},fromOffset={x:from.x+offsetVector.x,y:from.y+offsetVector.y},toOffset={x:to3.x+offsetVector.x,y:to3.y+offsetVector.y};updateBounds({center:fromOffset,width:0,height:0}),updateBounds({center:toOffset,width:0,height:0});let extensionDirection=hasOffsetDirection&&(Math.abs(normalizedOffsetDirection.x)>Number.EPSILON||Math.abs(normalizedOffsetDirection.y)>Number.EPSILON)?normalizedOffsetDirection:perpendicular,extensionLength=offsetMagnitude+arrow_size,fromExtEnd={x:from.x+extensionDirection.x*extensionLength,y:from.y+extensionDirection.y*extensionLength},toExtEnd={x:to3.x+extensionDirection.x*extensionLength,y:to3.y+extensionDirection.y*extensionLength};updateBounds({center:fromExtEnd,width:0,height:0}),updateBounds({center:toExtEnd,width:0,height:0});let arrowHalfWidth=arrow_size/2,fromBase={x:fromOffset.x+direction2.x*arrow_size,y:fromOffset.y+direction2.y*arrow_size},toBase={x:toOffset.x-direction2.x*arrow_size,y:toOffset.y-direction2.y*arrow_size},fromArrowP2={x:fromBase.x+perpendicular.x*arrowHalfWidth,y:fromBase.y+perpendicular.y*arrowHalfWidth},fromArrowP3={x:fromBase.x-perpendicular.x*arrowHalfWidth,y:fromBase.y-perpendicular.y*arrowHalfWidth};updateBounds({center:fromArrowP2,width:0,height:0}),updateBounds({center:fromArrowP3,width:0,height:0});let toArrowP2={x:toBase.x+perpendicular.x*arrowHalfWidth,y:toBase.y+perpendicular.y*arrowHalfWidth},toArrowP3={x:toBase.x-perpendicular.x*arrowHalfWidth,y:toBase.y-perpendicular.y*arrowHalfWidth};if(updateBounds({center:toArrowP2,width:0,height:0}),updateBounds({center:toArrowP3,width:0,height:0}),text){let midPoint2={x:(from.x+to3.x)/2+offsetVector.x,y:(from.y+to3.y)/2+offsetVector.y},textOffset=arrow_size*1.5,textPoint={x:midPoint2.x+perpendicular.x*textOffset,y:midPoint2.y+perpendicular.y*textOffset},textWidth=text.length*font_size*.6;updateBounds({center:textPoint,width:textWidth,height:font_size})}}else if(circuitJsonElm.type==="pcb_cutout"){let cutout=circuitJsonElm;if(cutout.shape==="rect")updateBounds({center:cutout.center,width:cutout.width,height:cutout.height});else if(cutout.shape==="circle"){let radius=distance.parse(cutout.radius);radius!==void 0&&updateBounds({center:cutout.center,width:radius*2,height:radius*2})}else if(cutout.shape==="polygon")updateTraceBounds(cutout.points);else if(cutout.shape==="path"){let cutoutPath=cutout;cutoutPath.route&&Array.isArray(cutoutPath.route)&&updateTraceBounds(cutoutPath.route)}}else if(circuitJsonElm.type==="pcb_keepout"){let keepout=circuitJsonElm;if(keepout.shape==="rect")updateBounds({center:keepout.center,width:keepout.width,height:keepout.height});else if(keepout.shape==="circle"){let radius=typeof keepout.radius=="number"?keepout.radius:distance.parse(keepout.radius)??0;radius>0&&updateBounds({center:keepout.center,width:radius*2,height:radius*2})}}else circuitJsonElm.type==="pcb_silkscreen_text"||circuitJsonElm.type==="pcb_silkscreen_rect"||circuitJsonElm.type==="pcb_silkscreen_circle"||circuitJsonElm.type==="pcb_silkscreen_line"||circuitJsonElm.type==="pcb_silkscreen_oval"?updateSilkscreenBounds(circuitJsonElm):circuitJsonElm.type==="pcb_copper_text"?updateBounds({center:circuitJsonElm.anchor_position,width:0,height:0}):circuitJsonElm.type==="pcb_copper_pour"&&(circuitJsonElm.shape==="rect"?updateBounds({center:circuitJsonElm.center,width:circuitJsonElm.width,height:circuitJsonElm.height}):circuitJsonElm.shape==="polygon"&&updateTraceBounds(circuitJsonElm.points));return{minX,minY,maxX,maxY,boardMinX,boardMinY,boardMaxX,boardMaxY,hasBounds:hasBounds2,hasBoardBounds};function updateBounds({center:center2,width,height}){if(!center2)return;let centerX=distance.parse(center2.x),centerY=distance.parse(center2.y);if(centerX===void 0||centerY===void 0)return;let numericWidth=distance.parse(width)??0,numericHeight=distance.parse(height)??0,halfWidth=numericWidth/2,halfHeight=numericHeight/2;minX=Math.min(minX,centerX-halfWidth),minY=Math.min(minY,centerY-halfHeight),maxX=Math.max(maxX,centerX+halfWidth),maxY=Math.max(maxY,centerY+halfHeight),hasBounds2=!0}function updateBoardBounds({center:center2,width,height}){if(!center2)return;let centerX=distance.parse(center2.x),centerY=distance.parse(center2.y);if(centerX===void 0||centerY===void 0)return;let numericWidth=distance.parse(width)??0,numericHeight=distance.parse(height)??0,halfWidth=numericWidth/2,halfHeight=numericHeight/2;boardMinX=Math.min(boardMinX,centerX-halfWidth),boardMinY=Math.min(boardMinY,centerY-halfHeight),boardMaxX=Math.max(boardMaxX,centerX+halfWidth),boardMaxY=Math.max(boardMaxY,centerY+halfHeight),hasBounds2=!0,hasBoardBounds=!0}function updateBoundsToIncludeOutline(outline){let updated=!1;for(let point7 of outline){let x4=distance.parse(point7.x),y4=distance.parse(point7.y);x4===void 0||y4===void 0||(minX=Math.min(minX,x4),minY=Math.min(minY,y4),maxX=Math.max(maxX,x4),maxY=Math.max(maxY,y4),updated=!0)}updated&&(hasBounds2=!0)}function updateBoardBoundsToIncludeOutline(outline){let updated=!1;for(let point7 of outline){let x4=distance.parse(point7.x),y4=distance.parse(point7.y);x4===void 0||y4===void 0||(boardMinX=Math.min(boardMinX,x4),boardMinY=Math.min(boardMinY,y4),boardMaxX=Math.max(boardMaxX,x4),boardMaxY=Math.max(boardMaxY,y4),updated=!0)}updated&&(hasBounds2=!0,hasBoardBounds=!0)}function updateTraceBounds(route){let updated=!1;for(let point7 of route){let x4=distance.parse(point7?.x),y4=distance.parse(point7?.y);x4===void 0||y4===void 0||(minX=Math.min(minX,x4),minY=Math.min(minY,y4),maxX=Math.max(maxX,x4),maxY=Math.max(maxY,y4),updated=!0)}updated&&(hasBounds2=!0)}function updateSilkscreenBounds(item){if(item.type==="pcb_silkscreen_text")updateBounds({center:item.anchor_position,width:0,height:0});else if(item.type==="pcb_silkscreen_path")updateTraceBounds(item.route);else if(item.type==="pcb_silkscreen_rect")updateBounds({center:item.center,width:item.width,height:item.height});else if(item.type==="pcb_silkscreen_circle"){let radius=distance.parse(item.radius);radius!==void 0&&updateBounds({center:item.center,width:radius*2,height:radius*2})}else if(item.type==="pcb_silkscreen_line")updateBounds({center:{x:item.x1,y:item.y1},width:0,height:0}),updateBounds({center:{x:item.x2,y:item.y2},width:0,height:0});else if(item.type==="pcb_silkscreen_oval"){let radiusX=distance.parse(item.radius_x),radiusY=distance.parse(item.radius_y);radiusX!==void 0&&radiusY!==void 0&&updateBounds({center:item.center,width:radiusX*2,height:radiusY*2})}else if(item.type==="pcb_cutout"){let cutout=item;if(cutout.shape==="rect")updateBounds({center:cutout.center,width:cutout.width,height:cutout.height});else if(cutout.shape==="circle"){let radius=distance.parse(cutout.radius);radius!==void 0&&updateBounds({center:cutout.center,width:radius*2,height:radius*2})}else if(cutout.shape==="polygon")updateTraceBounds(cutout.points);else if(cutout.shape==="path"){let cutoutPath=cutout;cutoutPath.route&&Array.isArray(cutoutPath.route)&&updateTraceBounds(cutoutPath.route)}}}}function rectBounds(center2,width,height){if(!center2||width===void 0||height===void 0)return;let cx3=distance.parse(center2.x),cy3=distance.parse(center2.y);if(cx3===void 0||cy3===void 0)return;let numericWidth=distance.parse(width),numericHeight=distance.parse(height);if(numericWidth===void 0||numericHeight===void 0)return;let halfW=numericWidth/2,halfH=numericHeight/2;return{minX:cx3-halfW,minY:cy3-halfH,maxX:cx3+halfW,maxY:cy3+halfH}}function getOutlineBounds(outline){if(!outline||outline.length<3)return;let minX=Number.POSITIVE_INFINITY,minY=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY;for(let pt3 of outline){let x4=distance.parse(pt3.x),y4=distance.parse(pt3.y);x4===void 0||y4===void 0||(minX=Math.min(minX,x4),minY=Math.min(minY,y4),maxX=Math.max(maxX,x4),maxY=Math.max(maxY,y4))}if(!(!Number.isFinite(minX)||!Number.isFinite(minY))&&!(!Number.isFinite(maxX)||!Number.isFinite(maxY)))return{minX,minY,maxX,maxY}}function convertCircuitJsonToPcbSvg(circuitJson,options){let drawPaddingOutsideBoard=options?.drawPaddingOutsideBoard??!0,layer=options?.layer,colorOverrides=options?.colorOverrides,copperColors={...DEFAULT_PCB_COLOR_MAP.copper};if(colorOverrides?.copper)for(let[layerName,color]of Object.entries(colorOverrides.copper))color!==void 0&&(copperColors[layerName]=color);let colorMap2={copper:copperColors,drill:colorOverrides?.drill??DEFAULT_PCB_COLOR_MAP.drill,silkscreen:{top:colorOverrides?.silkscreen?.top??DEFAULT_PCB_COLOR_MAP.silkscreen.top,bottom:colorOverrides?.silkscreen?.bottom??DEFAULT_PCB_COLOR_MAP.silkscreen.bottom},boardOutline:colorOverrides?.boardOutline??DEFAULT_PCB_COLOR_MAP.boardOutline,soldermask:{top:colorOverrides?.soldermask?.top??DEFAULT_PCB_COLOR_MAP.soldermask.top,bottom:colorOverrides?.soldermask?.bottom??DEFAULT_PCB_COLOR_MAP.soldermask.bottom},soldermaskOverCopper:{top:colorOverrides?.soldermaskOverCopper?.top??DEFAULT_PCB_COLOR_MAP.soldermaskOverCopper.top,bottom:colorOverrides?.soldermaskOverCopper?.bottom??DEFAULT_PCB_COLOR_MAP.soldermaskOverCopper.bottom},soldermaskWithCopperUnderneath:{top:colorOverrides?.soldermaskWithCopperUnderneath?.top??DEFAULT_PCB_COLOR_MAP.soldermaskWithCopperUnderneath.top,bottom:colorOverrides?.soldermaskWithCopperUnderneath?.bottom??DEFAULT_PCB_COLOR_MAP.soldermaskWithCopperUnderneath.bottom},substrate:colorOverrides?.substrate??DEFAULT_PCB_COLOR_MAP.substrate,courtyard:{top:colorOverrides?.courtyard?.top??DEFAULT_PCB_COLOR_MAP.courtyard.top,bottom:colorOverrides?.courtyard?.bottom??DEFAULT_PCB_COLOR_MAP.courtyard.bottom},keepout:colorOverrides?.keepout??DEFAULT_PCB_COLOR_MAP.keepout,debugComponent:{fill:colorOverrides?.debugComponent?.fill??DEFAULT_PCB_COLOR_MAP.debugComponent.fill,stroke:colorOverrides?.debugComponent?.stroke??DEFAULT_PCB_COLOR_MAP.debugComponent.stroke}},{minX,minY,maxX,maxY,boardMinX,boardMinY,boardMaxX,boardMaxY,hasBoardBounds}=getPcbBoundsFromCircuitJson(circuitJson),{boundsMinX,boundsMinY,boundsMaxX,boundsMaxY,padding}=getViewportBounds({circuitJson,drawPaddingOutsideBoard,baseBounds:{minX,minY,maxX,maxY,boardMinX,boardMinY,boardMaxX,boardMaxY,hasBoardBounds},viewportOptions:{viewport:options?.viewport,viewportTarget:options?.viewportTarget}}),circuitWidth=boundsMaxX-boundsMinX+2*padding,circuitHeight=boundsMaxY-boundsMinY+2*padding,svgWidth=options?.width??800,svgHeight=options?.height??600;if(options?.matchBoardAspectRatio){let viewportWidth=boundsMaxX-boundsMinX,viewportHeight=boundsMaxY-boundsMinY;if(viewportWidth>0&&viewportHeight>0){let aspect=viewportWidth/viewportHeight;options?.width&&!options?.height?svgHeight=options.width/aspect:options?.height&&!options?.width?svgWidth=options.height*aspect:svgHeight=svgWidth/aspect}}let paths=[];for(let circuitJsonElm of circuitJson)"route"in circuitJsonElm&&circuitJsonElm.route!==void 0&&paths.push(circuitJsonElm.route);let scaleX=svgWidth/circuitWidth,scaleY=svgHeight/circuitHeight,scaleFactor=Math.min(scaleX,scaleY),offsetX=(svgWidth-circuitWidth*scaleFactor)/2,offsetY=(svgHeight-circuitHeight*scaleFactor)/2,transform6=compose3(translate3(offsetX-boundsMinX*scaleFactor+padding*scaleFactor,svgHeight-offsetY+boundsMinY*scaleFactor-padding*scaleFactor),scale3(scaleFactor,-scaleFactor)),ctx={transform:transform6,layer,shouldDrawErrors:options?.shouldDrawErrors,showCourtyards:options?.showCourtyards,showPcbGroups:options?.showPcbGroups,drawPaddingOutsideBoard,colorMap:colorMap2,showSolderMask:options?.showSolderMask,showPcbNotes:options?.showPcbNotes??!0,showAnchorOffsets:options?.showAnchorOffsets,circuitJson},unsortedSvgObjects=circuitJson.flatMap(elm=>createSvgObjects({elm,circuitJson,ctx})),strokeWidth=String(.05*scaleFactor);for(let element of circuitJson)if("stroke_width"in element){strokeWidth=String(scaleFactor*element.stroke_width);break}if(options?.shouldDrawRatsNest){let ratsNestObjects=createSvgObjectsForRatsNest(circuitJson,ctx);unsortedSvgObjects=[...unsortedSvgObjects,...ratsNestObjects]}let svgObjects=sortSvgObjectsByPcbLayer(unsortedSvgObjects),children=[{name:"style",type:"element",value:"",attributes:{},children:[{type:"text",value:"",name:"",attributes:{},children:[]}]}],gridObjects=createSvgObjectsForPcbGrid({grid:options?.grid,svgWidth,svgHeight});if(gridObjects.defs&&children.push(gridObjects.defs),circuitJson.some(elm=>elm.type==="pcb_keepout")&&children.push(createKeepoutPatternDefs(colorMap2.keepout??DEFAULT_PCB_COLOR_MAP.keepout)),children.push({name:"rect",type:"element",value:"",attributes:{class:"boundary",x:"0",y:"0",fill:options?.backgroundColor??"#000",width:svgWidth.toString(),height:svgHeight.toString(),"data-type":"pcb_background","data-pcb-layer":"global"},children:[]}),drawPaddingOutsideBoard&&children.push(createSvgObjectFromPcbBoundary(transform6,minX,minY,maxX,maxY)),children.push(...svgObjects),gridObjects.rect&&children.push(gridObjects.rect),options?.showErrorsInTextOverlay){let errorOverlay=createErrorTextOverlay(circuitJson,"pcb_error_text_overlay");errorOverlay&&children.push(errorOverlay)}let softwareUsedString=getSoftwareUsedString(circuitJson),version2=CIRCUIT_TO_SVG_VERSION,svgObject={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:svgWidth.toString(),height:svgHeight.toString(),...softwareUsedString&&{"data-software-used-string":softwareUsedString},...options?.includeVersion&&{"data-circuit-to-svg-version":version2}},value:"",children:children.filter(child=>child!==null)};try{return(0,import_svgson2.stringify)(svgObject)}catch(error2){throw console.error("Error stringifying SVG object:",error2),error2}}function createSvgObjects({elm,circuitJson,ctx}){switch(elm.type){case"pcb_trace_error":return createSvgObjectsFromPcbTraceError(elm,circuitJson,ctx).filter(Boolean);case"pcb_footprint_overlap_error":return createSvgObjectsFromPcbFootprintOverlapError(elm,circuitJson,ctx).filter(Boolean);case"pcb_courtyard_overlap_error":return createSvgObjectsFromPcbCourtyardOverlapError(elm,circuitJson,ctx).filter(Boolean);case"pcb_component_outside_board_error":return createSvgObjectsFromPcbComponentOutsideBoardError(elm,circuitJson,ctx).filter(Boolean);case"pcb_via_trace_clearance_error":return createSvgObjectsFromPcbViaTraceClearanceError(elm,circuitJson,ctx).filter(Boolean);case"pcb_component":return createSvgObjectsFromPcbComponent(elm,ctx).filter(Boolean);case"pcb_trace":return createSvgObjectsFromPcbTrace(elm,ctx);case"pcb_copper_pour":return createSvgObjectsFromPcbCopperPour(elm,ctx);case"pcb_plated_hole":return createSvgObjectsFromPcbPlatedHole(elm,ctx).filter(Boolean);case"pcb_hole":return createSvgObjectsFromPcbHole(elm,ctx);case"pcb_smtpad":return createSvgObjectsFromSmtPad(elm,ctx);case"pcb_silkscreen_text":return createSvgObjectsFromPcbSilkscreenText(elm,ctx);case"pcb_silkscreen_rect":return createSvgObjectsFromPcbSilkscreenRect(elm,ctx);case"pcb_silkscreen_circle":return createSvgObjectsFromPcbSilkscreenCircle(elm,ctx);case"pcb_silkscreen_line":return createSvgObjectsFromPcbSilkscreenLine(elm,ctx);case"pcb_silkscreen_pill":return createSvgObjectsFromPcbSilkscreenPill(elm,ctx);case"pcb_silkscreen_oval":return createSvgObjectsFromPcbSilkscreenOval(elm,ctx);case"pcb_copper_text":return createSvgObjectsFromPcbCopperText(elm,ctx);case"pcb_courtyard_rect":return ctx.showCourtyards?createSvgObjectsFromPcbCourtyardRect(elm,ctx):[];case"pcb_courtyard_polygon":return ctx.showCourtyards?createSvgObjectsFromPcbCourtyardPolygon(elm,ctx):[];case"pcb_courtyard_circle":return ctx.showCourtyards?createSvgObjectsFromPcbCourtyardCircle(elm,ctx):[];case"pcb_courtyard_outline":return ctx.showCourtyards?createSvgObjectsFromPcbCourtyardOutline(elm,ctx):[];case"pcb_fabrication_note_path":return createSvgObjectsFromPcbFabricationNotePath(elm,ctx);case"pcb_fabrication_note_text":return createSvgObjectsFromPcbFabricationNoteText(elm,ctx);case"pcb_fabrication_note_rect":return createSvgObjectsFromPcbFabricationNoteRect(elm,ctx);case"pcb_fabrication_note_dimension":return createSvgObjectsFromPcbFabricationNoteDimension(elm,ctx);case"pcb_note_dimension":return ctx.showPcbNotes?createSvgObjectsFromPcbNoteDimension(elm,ctx):[];case"pcb_note_text":return ctx.showPcbNotes?createSvgObjectsFromPcbNoteText(elm,ctx):[];case"pcb_note_rect":return ctx.showPcbNotes?createSvgObjectsFromPcbNoteRect(elm,ctx):[];case"pcb_note_path":return ctx.showPcbNotes?createSvgObjectsFromPcbNotePath(elm,ctx):[];case"pcb_note_line":return ctx.showPcbNotes?createSvgObjectsFromPcbNoteLine(elm,ctx):[];case"pcb_silkscreen_path":return createSvgObjectsFromPcbSilkscreenPath(elm,ctx);case"pcb_panel":return ctx.drawPaddingOutsideBoard?createSvgObjectsFromPcbPanel(elm,ctx):[];case"pcb_board":return ctx.drawPaddingOutsideBoard?createSvgObjectsFromPcbBoard(elm,ctx):[];case"pcb_via":return createSvgObjectsFromPcbVia(elm,ctx);case"pcb_cutout":let cutout=elm;return cutout.shape==="path"?createSvgObjectsFromPcbCutoutPath(cutout,ctx):createSvgObjectsFromPcbCutout(elm,ctx);case"pcb_keepout":return createSvgObjectsFromPcbKeepout(elm,ctx);case"pcb_group":return ctx.showPcbGroups?createSvgObjectsFromPcbGroup(elm,ctx):[];default:return[]}}function createSvgObjectFromPcbBoundary(transform6,minX,minY,maxX,maxY){let[x12,y12]=applyToPoint3(transform6,[minX,minY]),[x22,y22]=applyToPoint3(transform6,[maxX,maxY]),width=Math.abs(x22-x12),height=Math.abs(y22-y12),x4=Math.min(x12,x22),y4=Math.min(y12,y22);return{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-boundary",fill:"none",stroke:"#fff","stroke-width":"0.3",x:x4.toString(),y:y4.toString(),width:width.toString(),height:height.toString(),"data-type":"pcb_boundary","data-pcb-layer":"global"}}}function createSvgObjectsFromAssemblyBoard(pcbBoard,transform6,style={}){let{width,height,center:center2,outline}=pcbBoard,path;if(outline&&Array.isArray(outline)&&outline.length>=3)path=outline.map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ");else{let halfWidth=width/2,halfHeight=height/2,topLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y-halfHeight]),topRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),bottomRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y+halfHeight]),bottomLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]);path=`M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]}`}return path+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:path,fill:style.fill??DEFAULT_BOARD_STYLE.fill,stroke:style.stroke??DEFAULT_BOARD_STYLE.stroke,"stroke-opacity":style.strokeOpacity??DEFAULT_BOARD_STYLE.strokeOpacity,"stroke-width":((style.strokeWidthFactor??DEFAULT_BOARD_STYLE.strokeWidthFactor)*Math.abs(transform6.a)).toString()}}]}function createSvgObjectsFromAssemblyComponent(params,ctx){let{elm,portPosition,name,arePinsInterchangeable}=params,{transform:transform6}=ctx,{center:center2,width,height,rotation:rotation5=0,layer="top"}=elm;if(!center2||typeof width!="number"||typeof height!="number")return null;let[x4,y4]=applyToPoint3(transform6,[center2.x,center2.y]),[pinX,pinY]=applyToPoint3(transform6,[portPosition.x,portPosition.y]),scaledWidth=width*Math.abs(transform6.a),scaledHeight=height*Math.abs(transform6.d),isTopLayer=layer==="top",isPinTop=pinY>y4,isPinLeft=pinX<x4,children=[createComponentPath(scaledWidth,scaledHeight,rotation5,layer),createComponentLabel(scaledWidth,scaledHeight,name??"",transform6)];return arePinsInterchangeable||children.push(createPin1Indicator(scaledWidth,scaledHeight,rotation5,layer,isPinTop,isPinLeft)),{name:"g",type:"element",value:"",attributes:{transform:`translate(${x4}, ${y4}) scale(1, -1)`},children}}function createComponentPath(scaledWidth,scaledHeight,rotation5,layer){let w4=scaledWidth/2,h6=scaledHeight/2;return{name:"path",type:"element",attributes:{class:"assembly-component",d:getRectPathData(w4,h6,rotation5),"stroke-width":.8.toFixed(2),transform:`rotate(${-rotation5})`,"stroke-dasharray":layer==="bottom"?"2,2":""},value:"",children:[]}}function createComponentLabel(scaledWidth,scaledHeight,name,transform6){let size3=Math.min(scaledWidth,scaledHeight),fontSize=Math.min(58,Math.max(3,size3*.8)),isTall=scaledHeight>scaledWidth;return{name:"text",type:"element",attributes:{x:"0",y:"0",class:"assembly-component-label","text-anchor":"middle",dy:".10em",style:"pointer-events: none","font-size":`${fontSize.toFixed(1)}px`,transform:isTall?"rotate(90) scale(1, -1)":"scale(1, -1)"},children:[{type:"text",value:name||"",name:"",attributes:{},children:[]}],value:""}}function createPin1Indicator(scaledWidth,scaledHeight,rotation5,layer,isPinTop,isPinLeft){let w4=scaledWidth/2,h6=scaledHeight/2,indicatorSize=Math.min(w4,h6)*.5,points;return isPinTop&&isPinLeft?points=[[-w4,-h6],[-w4+indicatorSize,-h6],[-w4,-h6+indicatorSize]]:isPinTop&&!isPinLeft?points=[[w4,-h6],[w4-indicatorSize,-h6],[w4,-h6+indicatorSize]]:!isPinTop&&isPinLeft?points=[[-w4,h6],[-w4+indicatorSize,h6],[-w4,h6-indicatorSize]]:points=[[w4,h6],[w4-indicatorSize,h6],[w4,h6-indicatorSize]],{name:"polygon",type:"element",attributes:{class:"assembly-pin1-indicator",points:points.map(p4=>p4.join(",")).join(" "),fill:"#333",stroke:"none",transform:`rotate(${-rotation5})`},value:"",children:[]}}function getRectPathData(w4,h6,rotation5){let rotatePoint6=(x4,y4,angle)=>{let rad=Math.PI/180*angle,cos6=Math.cos(rad),sin6=Math.sin(rad);return[x4*cos6-y4*sin6,x4*sin6+y4*cos6]};return`${[[-w4,-h6],[w4,-h6],[w4,h6],[-w4,h6]].map(([x4,y4])=>rotatePoint6(x4,y4,rotation5)).map(([x4,y4],i3)=>i3===0?`M${x4},${y4}`:`L${x4},${y4}`).join(" ")} Z`}function createSvgObjectsFromAssemblyHole(hole,ctx){let{transform:transform6}=ctx,[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]);if(hole.hole_shape==="circle"||hole.hole_shape==="square"){let scaledDiameter=hole.hole_diameter*Math.abs(transform6.a),radius=scaledDiameter/2;return hole.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"assembly-hole",cx:x4.toString(),cy:y4.toString(),r:radius.toString(),fill:HOLE_COLOR2},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"assembly-hole",x:(x4-radius).toString(),y:(y4-radius).toString(),width:scaledDiameter.toString(),height:scaledDiameter.toString(),fill:HOLE_COLOR2},children:[],value:""}]}if(hole.hole_shape==="oval"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),rx3=scaledWidth/2,ry3=scaledHeight/2;return[{name:"ellipse",type:"element",attributes:{class:"assembly-hole",cx:x4.toString(),cy:y4.toString(),rx:rx3.toString(),ry:ry3.toString(),fill:HOLE_COLOR2},children:[],value:""}]}return[]}function createSvgObjectsFromAssemblyPlatedHole(hole,ctx){let{transform:transform6}=ctx,[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]);if(hole.shape==="pill"){let scaledOuterWidth=hole.outer_width*Math.abs(transform6.a),scaledOuterHeight=hole.outer_height*Math.abs(transform6.a),scaledHoleWidth=hole.hole_width*Math.abs(transform6.a),scaledHoleHeight=hole.hole_height*Math.abs(transform6.a),outerRadiusX=scaledOuterWidth/2,straightLength=scaledOuterHeight-scaledOuterWidth,innerRadiusX=scaledHoleWidth/2;return[{name:"g",type:"element",children:[{name:"path",type:"element",attributes:{class:"assembly-hole-outer",fill:PAD_COLOR,d:`M${x4-outerRadiusX},${y4-straightLength/2} v${straightLength} a${outerRadiusX},${outerRadiusX} 0 0 0 ${scaledOuterWidth},0 v-${straightLength} a${outerRadiusX},${outerRadiusX} 0 0 0 -${scaledOuterWidth},0 z`},value:"",children:[]},{name:"path",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,d:`M${x4-innerRadiusX},${y4-(scaledHoleHeight-scaledHoleWidth)/2} v${scaledHoleHeight-scaledHoleWidth} a${innerRadiusX},${innerRadiusX} 0 0 0 ${scaledHoleWidth},0 v-${scaledHoleHeight-scaledHoleWidth} a${innerRadiusX},${innerRadiusX} 0 0 0 -${scaledHoleWidth},0 z`},value:"",children:[]}],value:"",attributes:{}}]}if(hole.shape==="circle"){let scaledOuterWidth=hole.outer_diameter*Math.abs(transform6.a),scaledOuterHeight=hole.outer_diameter*Math.abs(transform6.a),scaledHoleWidth=hole.hole_diameter*Math.abs(transform6.a),scaledHoleHeight=hole.hole_diameter*Math.abs(transform6.a),outerRadius=Math.min(scaledOuterWidth,scaledOuterHeight)/2,innerRadius=Math.min(scaledHoleWidth,scaledHoleHeight)/2;return[{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"assembly-hole-outer",fill:PAD_COLOR,cx:x4.toString(),cy:y4.toString(),r:outerRadius.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,cx:x4.toString(),cy:y4.toString(),r:innerRadius.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(hole.shape==="circular_hole_with_rect_pad"){let circularHole=hole,scaledHoleDiameter=circularHole.hole_diameter*Math.abs(transform6.a),scaledRectPadWidth=circularHole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=circularHole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(circularHole.rect_border_radius??0)*Math.abs(transform6.a),rectCcwRotation=circularHole.rect_ccw_rotation??0,holeRadius=scaledHoleDiameter/2,[holeCx,holeCy]=applyToPoint3(transform6,[circularHole.x+circularHole.hole_offset_x,circularHole.y+circularHole.hole_offset_y]);return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:PAD_COLOR,...rectCcwRotation?{x:(-scaledRectPadWidth/2).toString(),y:(-scaledRectPadHeight/2).toString(),transform:`translate(${x4} ${y4}) rotate(${-rectCcwRotation})`}:{x:(x4-scaledRectPadWidth/2).toString(),y:(y4-scaledRectPadHeight/2).toString()},width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{}},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,cx:holeCx.toString(),cy:holeCy.toString(),r:holeRadius.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(hole.shape==="pill_hole_with_rect_pad"){let pillHole=hole,scaledRectPadWidth=pillHole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=pillHole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(pillHole.rect_border_radius??0)*Math.abs(transform6.a),scaledHoleHeight=pillHole.hole_height*Math.abs(transform6.a),scaledHoleWidth=pillHole.hole_width*Math.abs(transform6.a),pillHoleWithOffsets=pillHole,holeOffsetX=pillHoleWithOffsets.hole_offset_x??0,holeOffsetY=pillHoleWithOffsets.hole_offset_y??0,[holeCenterX,holeCenterY]=applyToPoint3(transform6,[pillHole.x+holeOffsetX,pillHole.y+holeOffsetY]),holeRadius=Math.min(scaledHoleHeight,scaledHoleWidth)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:PAD_COLOR,x:(x4-scaledRectPadWidth/2).toString(),y:(y4-scaledRectPadHeight/2).toString(),width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{}},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,x:(holeCenterX-scaledHoleWidth/2).toString(),y:(holeCenterY-scaledHoleHeight/2).toString(),width:scaledHoleWidth.toString(),height:scaledHoleHeight.toString(),rx:holeRadius.toString(),ry:holeRadius.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(hole.shape==="rotated_pill_hole_with_rect_pad"){let rotatedHole=hole,scaledRectPadWidth=rotatedHole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=rotatedHole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(rotatedHole.rect_border_radius??0)*Math.abs(transform6.a),scaledHoleHeight=rotatedHole.hole_height*Math.abs(transform6.a),scaledHoleWidth=rotatedHole.hole_width*Math.abs(transform6.a),rotatedHoleWithOffsets=rotatedHole,holeOffsetX=rotatedHoleWithOffsets.hole_offset_x??0,holeOffsetY=rotatedHoleWithOffsets.hole_offset_y??0,[holeCenterX,holeCenterY]=applyToPoint3(transform6,[rotatedHole.x+holeOffsetX,rotatedHole.y+holeOffsetY]),holeRadius=Math.min(scaledHoleHeight,scaledHoleWidth)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:PAD_COLOR,x:(-scaledRectPadWidth/2).toString(),y:(-scaledRectPadHeight/2).toString(),width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),transform:`translate(${x4} ${y4}) rotate(${-rotatedHole.rect_ccw_rotation})`,...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{}},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,x:(-scaledHoleWidth/2).toString(),y:(-scaledHoleHeight/2).toString(),width:scaledHoleWidth.toString(),height:scaledHoleHeight.toString(),rx:holeRadius.toString(),ry:holeRadius.toString(),transform:`translate(${holeCenterX} ${holeCenterY}) rotate(${-rotatedHole.hole_ccw_rotation})`},value:"",children:[]}],value:"",attributes:{}}]}return[]}function createSvgObjectsFromAssemblySmtPad(pad2,ctx){let{transform:transform6}=ctx;if(pad2.shape==="rect"||pad2.shape==="rotated_rect"){let width=pad2.width*Math.abs(transform6.a),height=pad2.height*Math.abs(transform6.d),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]),scaledBorderRadius=(pad2.rect_border_radius??0)*Math.abs(transform6.a);return pad2.shape==="rotated_rect"&&pad2.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,x:(-width/2).toString(),y:(-height/2).toString(),width:width.toString(),height:height.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}},value:"",children:[]}]:[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),"data-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}},value:"",children:[]}]}if(pad2.shape==="pill"){let width=pad2.width*Math.abs(transform6.a),height=pad2.height*Math.abs(transform6.d),radius=pad2.radius*Math.abs(transform6.a),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]);return[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),rx:radius.toString(),ry:radius.toString(),"data-layer":pad2.layer},value:"",children:[]}]}if(pad2.shape==="circle"){let radius=pad2.radius*Math.abs(transform6.a),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]);return[{name:"circle",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-layer":pad2.layer},value:"",children:[]}]}if(pad2.shape==="polygon"){let points=(pad2.points??[]).map(point7=>applyToPoint3(transform6,[point7.x,point7.y]));return[{name:"polygon",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,points:points.map(p4=>p4.join(",")).join(" "),"data-layer":pad2.layer},value:"",children:[]}]}return[]}function convertCircuitJsonToAssemblySvg(soup,options){let minX=Number.POSITIVE_INFINITY,minY=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY;for(let item of soup)if(item.type==="pcb_board"){let center2=item.center,width=item.width||0,height=item.height||0;minX=Math.min(minX,center2.x-width/2),minY=Math.min(minY,center2.y-height/2),maxX=Math.max(maxX,center2.x+width/2),maxY=Math.max(maxY,center2.y+height/2)}let padding=1,circuitWidth=maxX-minX+2*padding,circuitHeight=maxY-minY+2*padding,svgWidth=options?.width??800,svgHeight=options?.height??600,scaleX=svgWidth/circuitWidth,scaleY=svgHeight/circuitHeight,scaleFactor=Math.min(scaleX,scaleY),offsetX=(svgWidth-circuitWidth*scaleFactor)/2,offsetY=(svgHeight-circuitHeight*scaleFactor)/2,transform6=compose3(translate3(offsetX-minX*scaleFactor+padding*scaleFactor,svgHeight-offsetY+minY*scaleFactor-padding*scaleFactor),scale3(scaleFactor,-scaleFactor)),ctx={transform:transform6},svgObjects=soup.sort((a3,b3)=>(OBJECT_ORDER.indexOf(b3.type)??9999)-(OBJECT_ORDER.indexOf(a3.type)??9999)).flatMap(item=>createSvgObjects2(item,ctx,soup)),softwareUsedString=getSoftwareUsedString(soup),version2=CIRCUIT_TO_SVG_VERSION,children=[{name:"style",type:"element",children:[{type:"text",value:`
|
|
227
|
+
`),charSpacing=alphabetBounds.width*INTER_CHAR_SPACING_RATIO,lineHeight=fontSize*alphabetBounds.height*LINE_HEIGHT_MULTIPLIER,totalHeight=textLines.length*lineHeight,charAdvance=(alphabetBounds.width+charSpacing)*fontSize,lineWidths=[],maxWidth=0;for(let line2 of textLines){let width=0;for(let char of line2)char===" "?width+=charAdvance*.6:width+=charAdvance;width=width>0?width-charSpacing*fontSize:0,lineWidths.push(width),width>maxWidth&&(maxWidth=width)}let paths=[],y4=-totalHeight/2;for(let i3=0;i3<textLines.length;i3++){let line2=textLines[i3],x4=-lineWidths[i3]/2;for(let char of line2){if(char===" "){x4+=charAdvance*.6;continue}let charLines=lineAlphabet[char];charLines&&paths.push(linesToPathData(charLines,x4,y4,fontSize)),x4+=charAdvance}y4+=lineHeight}return{pathData:paths.join(" "),width:maxWidth,height:totalHeight}}function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{anchor_position,text,font_size=1,layer="top",ccw_rotation=0,anchor_alignment="center",is_knockout=!1,knockout_padding,is_mirrored=!1}=pcbSilkscreenText;if(layerFilter&&layer!==layerFilter)return[];if(!anchor_position||typeof anchor_position.x!="number"||typeof anchor_position.y!="number")return debugPcb(`[pcb_silkscreen_text] Invalid anchor_position for "${pcbSilkscreenText.pcb_silkscreen_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[anchor_position.x,anchor_position.y]),scaleFactor=Math.abs(transform6.a),silkscreenColor=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top,applyMirror=layer==="bottom"?!0:is_mirrored===!0;if(is_knockout){let scaledFontSize=font_size*.6666666666666666/alphabetBounds.height,{pathData,width,height}=textToCenteredAlphabetPaths(text,scaledFontSize),padLeft=knockout_padding?.left??scaledFontSize*.5,padRight=knockout_padding?.right??scaledFontSize*.5,padTop=knockout_padding?.top??scaledFontSize*.3,padBottom=knockout_padding?.bottom??scaledFontSize*.3,rectX=-width/2-padLeft,rectY=-height/2-padTop,rectW=width+padLeft+padRight,rectH=height+padTop+padBottom,strokeWidth=scaledFontSize*.15,knockoutTransform=toString2(compose3(translate3(transformedX,transformedY),rotate3(-ccw_rotation*Math.PI/180),...applyMirror?[scale3(-1,1)]:[],scale3(scaleFactor,scaleFactor))),maskId=`silkscreen-knockout-mask-${pcbSilkscreenText.pcb_silkscreen_text_id}-${silkscreenMaskIdCounter++}`;return[{name:"defs",type:"element",value:"",children:[{name:"mask",type:"element",value:"",attributes:{id:maskId},children:[{name:"rect",type:"element",value:"",attributes:{x:rectX.toString(),y:rectY.toString(),width:rectW.toString(),height:rectH.toString(),fill:"white"},children:[]},{name:"path",type:"element",value:"",attributes:{d:pathData,fill:"none",stroke:"black","stroke-width":strokeWidth.toString(),"stroke-linecap":"round","stroke-linejoin":"round"},children:[]}]}],attributes:{}},{name:"rect",type:"element",value:"",children:[],attributes:{x:rectX.toString(),y:rectY.toString(),width:rectW.toString(),height:rectH.toString(),fill:silkscreenColor,mask:`url(#${maskId})`,transform:knockoutTransform,class:`pcb-silkscreen-text-knockout pcb-silkscreen-${layer}`,"data-type":"pcb_silkscreen_text","data-pcb-silkscreen-text-id":pcbSilkscreenText.pcb_silkscreen_text_id,"data-pcb-layer":layer}}]}let transformedFontSize=font_size*scaleFactor,textAnchor="middle",dominantBaseline="central",dx3=0,dy3=0;switch(anchor_alignment){case"top_left":textAnchor="start",dominantBaseline="text-before-edge";break;case"top_center":textAnchor="middle",dominantBaseline="text-before-edge";break;case"top_right":textAnchor="end",dominantBaseline="text-before-edge";break;case"center_left":textAnchor="start",dominantBaseline="central";break;case"center_right":textAnchor="end",dominantBaseline="central";break;case"bottom_left":textAnchor="start",dominantBaseline="text-after-edge";break;case"bottom_center":textAnchor="middle",dominantBaseline="text-after-edge";break;case"bottom_right":textAnchor="end",dominantBaseline="text-after-edge";break;default:textAnchor="middle",dominantBaseline="central";break}let textTransform=compose3(translate3(transformedX,transformedY),rotate3(-ccw_rotation*Math.PI/180),...layer==="bottom"?[scale3(-1,1)]:[]),lines=text.split(`
|
|
228
|
+
`),children=lines.length===1?[{type:"text",value:text,name:"",attributes:{},children:[]}]:lines.map((line2,idx)=>({type:"element",name:"tspan",value:"",attributes:{x:"0",...idx>0?{dy:transformedFontSize.toString()}:{}},children:[{type:"text",value:line2,name:"",attributes:{},children:[]}]}));return[{name:"text",type:"element",attributes:{x:"0",y:"0",dx:dx3.toString(),dy:dy3.toString(),fill:silkscreenColor,"font-family":"Arial, sans-serif","font-size":transformedFontSize.toString(),"text-anchor":textAnchor,"dominant-baseline":dominantBaseline,transform:toString2(textTransform),class:`pcb-silkscreen-text pcb-silkscreen-${layer}`,"data-pcb-silkscreen-text-id":pcbSilkscreenText.pcb_component_id,stroke:"none","data-type":"pcb_silkscreen_text","data-pcb-layer":layer},children,value:""}]}function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,width,height,layer="top",pcb_silkscreen_rect_id,stroke_width,is_filled,has_stroke,is_stroke_dashed,corner_radius,ccw_rotation=0}=pcbSilkscreenRect;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof width!="number"||typeof height!="number")return debugPcb(`[pcb_silkscreen_rect] Invalid data for "${pcb_silkscreen_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center2)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),baseCornerRadius=typeof corner_radius=="number"&&corner_radius>0?corner_radius:0,transformedCornerRadiusX=baseCornerRadius*Math.abs(transform6.a),transformedCornerRadiusY=baseCornerRadius*Math.abs(transform6.d),transformedWidth=width*Math.abs(transform6.a),transformedHeight=height*Math.abs(transform6.d),transformedStrokeWidth=stroke_width*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top,attributes2={x:(-transformedWidth/2).toString(),y:(-transformedHeight/2).toString(),width:transformedWidth.toString(),height:transformedHeight.toString(),class:`pcb-silkscreen-rect pcb-silkscreen-${layer}`,"data-pcb-silkscreen-rect-id":pcb_silkscreen_rect_id,"data-type":"pcb_silkscreen_rect","data-pcb-layer":layer};typeof ccw_rotation=="number"&&ccw_rotation!==0?attributes2.transform=`translate(${transformedX} ${transformedY}) rotate(${-ccw_rotation})`:(attributes2.x=(transformedX-transformedWidth/2).toString(),attributes2.y=(transformedY-transformedHeight/2).toString()),transformedCornerRadiusX>0&&(attributes2.rx=transformedCornerRadiusX.toString()),transformedCornerRadiusY>0&&(attributes2.ry=transformedCornerRadiusY.toString()),attributes2.fill=is_filled?color:"none";let actualHasStroke;if(has_stroke===void 0?actualHasStroke=transformedStrokeWidth>0:actualHasStroke=has_stroke,actualHasStroke){if(attributes2.stroke=color,attributes2["stroke-width"]=transformedStrokeWidth.toString(),is_stroke_dashed){let dashLength=.1*Math.abs(transform6.a),gapLength=.05*Math.abs(transform6.a);attributes2["stroke-dasharray"]=`${dashLength} ${gapLength}`}}else attributes2.stroke="none";return[{name:"rect",type:"element",attributes:attributes2,value:"",children:[]}]}function layerNameToColor(layerName,colorMap2=DEFAULT_PCB_COLOR_MAP){return colorMap2.copper[layerName]??"white"}function solderPasteLayerNameToColor(layerName){return SOLDER_PASTE_LAYER_NAME_TO_COLOR[layerName]??"rgb(105, 105, 105)"}function linesToPathData2(lines,offsetX,offsetY,charScale,baselineAdjust=0){return lines.map(line2=>{let x12=offsetX+line2.x1*charScale,y12=offsetY+(1-line2.y1+baselineAdjust)*charScale,x22=offsetX+line2.x2*charScale,y22=offsetY+(1-line2.y2+baselineAdjust)*charScale;return`M${x12} ${y12}L${x22} ${y22}`}).join(" ")}function textToAlphabetPath(text,fontSize){let paths=[],charAdvance=(CHAR_WIDTH+CHAR_SPACING)*fontSize,x4=0;for(let char of text){if(char===" "){x4+=charAdvance*.6;continue}let lines=lineAlphabet[char];lines&&paths.push(linesToPathData2(lines,x4,0,fontSize)),x4+=charAdvance}let width=x4>0?x4-CHAR_SPACING*fontSize:0;return{pathData:paths.join(" "),width}}function textToCenteredAlphabetPaths2(text,fontSize){let textLines=text.split(`
|
|
229
|
+
`),lineHeight=fontSize*LINE_HEIGHT,totalHeight=textLines.length*lineHeight,lineWidths=[],maxWidth=0;for(let line2 of textLines){let{width}=textToAlphabetPath(line2,fontSize);lineWidths.push(width),width>maxWidth&&(maxWidth=width)}let paths=[],y4=-totalHeight/2;for(let i3=0;i3<textLines.length;i3++){let line2=textLines[i3],lineWidth=lineWidths[i3],charAdvance=(CHAR_WIDTH+CHAR_SPACING)*fontSize,x4=-lineWidth/2;for(let char of line2){if(char===" "){x4+=charAdvance*.6;continue}let charLines=lineAlphabet[char];charLines&&paths.push(linesToPathData2(charLines,x4,y4,fontSize)),x4+=charAdvance}y4+=lineHeight}return{pathData:paths.join(" "),width:maxWidth,height:totalHeight}}function createSvgObjectsFromPcbCopperText(pcbCopperText,ctx){let{transform:transform6,layer:filterLayer,colorMap:colorMap2}=ctx,{anchor_position,text,font_size="0.2mm",layer,ccw_rotation=0,anchor_alignment="center",is_knockout=!1,knockout_padding,is_mirrored=!1}=pcbCopperText,layerName=layer??"top";if(filterLayer&&filterLayer!==layerName)return[];if(!anchor_position)return[];let[ax3,ay3]=applyToPoint3(transform6,[anchor_position.x,anchor_position.y]),fontSizeNum=distance.parse(font_size)??.2,scaleFactor=Math.abs(transform6.a),copperColor=layerNameToColor(layerName,colorMap2),applyMirror=layerName==="bottom"?!0:is_mirrored===!0;if(is_knockout){let scaledFontSize2=fontSizeNum*FONT_SCALE,{pathData:pathData2,width:width2,height:height2}=textToCenteredAlphabetPaths2(text,scaledFontSize2),padX=knockout_padding?.left??scaledFontSize2*.5,padY=knockout_padding?.top??scaledFontSize2*.3,rectW=width2+padX*2,rectH=height2+padY*2,strokeWidth2=scaledFontSize2*.15,knockoutTransform=toString2(compose3(translate3(ax3,ay3),rotate3(-ccw_rotation*Math.PI/180),...applyMirror?[scale3(-1,1)]:[],scale3(scaleFactor,scaleFactor))),maskId=`knockout-mask-${pcbCopperText.pcb_copper_text_id}-${maskIdCounter++}`;return[{name:"defs",type:"element",value:"",children:[{name:"mask",type:"element",value:"",attributes:{id:maskId},children:[{name:"rect",type:"element",value:"",attributes:{x:(-rectW/2).toString(),y:(-rectH/2).toString(),width:rectW.toString(),height:rectH.toString(),fill:"white"},children:[]},{name:"path",type:"element",value:"",attributes:{d:pathData2,fill:"none",stroke:"black","stroke-width":strokeWidth2.toString(),"stroke-linecap":"round","stroke-linejoin":"round"},children:[]}]}],attributes:{}},{name:"rect",type:"element",value:"",children:[],attributes:{x:(-rectW/2).toString(),y:(-rectH/2).toString(),width:rectW.toString(),height:rectH.toString(),fill:copperColor,mask:`url(#${maskId})`,transform:knockoutTransform,class:`pcb-copper-text-knockout pcb-copper-${layerName}`,"data-type":"pcb_copper_text","data-pcb-copper-text-id":pcbCopperText.pcb_copper_text_id}}]}let scaledFontSize=fontSizeNum*FONT_SCALE,{pathData,width,height}=textToCenteredAlphabetPaths2(text,scaledFontSize),offsetX=0,offsetY=0;switch(anchor_alignment){case"top_left":offsetX=width/2,offsetY=height/2;break;case"top_center":offsetY=height/2;break;case"top_right":offsetX=-width/2,offsetY=height/2;break;case"center_left":offsetX=width/2;break;case"center_right":offsetX=-width/2;break;case"bottom_left":offsetX=width/2,offsetY=-height/2;break;case"bottom_center":offsetY=-height/2;break;case"bottom_right":offsetX=-width/2,offsetY=-height/2;break}let textTransform=toString2(compose3(translate3(ax3,ay3),rotate3(-ccw_rotation*Math.PI/180),...applyMirror?[scale3(-1,1)]:[],translate3(offsetX,offsetY),scale3(scaleFactor,scaleFactor))),strokeWidth=scaledFontSize*.15;return[{name:"path",type:"element",attributes:{d:pathData,fill:"none",stroke:copperColor,"stroke-width":strokeWidth.toString(),"stroke-linecap":"round","stroke-linejoin":"round",transform:textTransform,class:`pcb-copper-text pcb-copper-${layerName}`,"data-type":"pcb_copper_text","data-pcb-copper-text-id":pcbCopperText.pcb_copper_text_id},children:[],value:""}]}function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,radius,layer="top",pcb_silkscreen_circle_id,stroke_width=1,is_filled}=pcbSilkscreenCircle;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof radius!="number")return console.error("Invalid PCB Silkscreen Circle data:",{center:center2,radius}),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedRadius=radius*Math.abs(transform6.a),transformedStrokeWidth=stroke_width*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"circle",type:"element",attributes:{cx:transformedX.toString(),cy:transformedY.toString(),r:transformedRadius.toString(),class:`pcb-silkscreen-circle pcb-silkscreen-${layer}`,fill:is_filled?color:"none",stroke:color,"stroke-width":transformedStrokeWidth.toString(),"data-pcb-silkscreen-circle-id":pcb_silkscreen_circle_id,"data-type":"pcb_silkscreen_circle","data-pcb-layer":layer},value:"",children:[]}]}function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{x1:x12,y1:y12,x2:x22,y2:y22,stroke_width,layer="top",pcb_silkscreen_line_id}=pcbSilkscreenLine;if(layerFilter&&layer!==layerFilter)return[];if(typeof x12!="number"||typeof y12!="number"||typeof x22!="number"||typeof y22!="number")return debugPcb(`[pcb_silkscreen_line] Invalid coordinates for "${pcb_silkscreen_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`),[];let[transformedX1,transformedY1]=applyToPoint3(transform6,[x12,y12]),[transformedX2,transformedY2]=applyToPoint3(transform6,[x22,y22]),transformedStrokeWidth=stroke_width*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"line",type:"element",attributes:{x1:transformedX1.toString(),y1:transformedY1.toString(),x2:transformedX2.toString(),y2:transformedY2.toString(),stroke:color,"stroke-width":transformedStrokeWidth.toString(),class:`pcb-silkscreen-line pcb-silkscreen-${layer}`,"data-pcb-silkscreen-line-id":pcb_silkscreen_line_id,"data-type":"pcb_silkscreen_line","data-pcb-layer":layer},value:"",children:[]}]}function createSvgObjectsFromPcbSilkscreenPill(pcbSilkscreenPill,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,width,height,layer="top",pcb_silkscreen_pill_id}=pcbSilkscreenPill;if(layerFilter&&layer!==layerFilter)return[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedWidth=width*Math.abs(transform6.a),transformedHeight=height*Math.abs(transform6.d),baseCornerRadius=Math.min(width,height)/2,transformedCornerRadiusX=baseCornerRadius*Math.abs(transform6.a),transformedCornerRadiusY=baseCornerRadius*Math.abs(transform6.d),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"rect",type:"element",attributes:{x:(transformedX-transformedWidth/2).toString(),y:(transformedY-transformedHeight/2).toString(),width:transformedWidth.toString(),height:transformedHeight.toString(),rx:transformedCornerRadiusX.toString(),ry:transformedCornerRadiusY.toString(),fill:"none",stroke:color,"stroke-width":(.1*Math.abs(transform6.a)).toString(),class:`pcb-silkscreen-pill pcb-silkscreen-${layer}`,"data-pcb-silkscreen-pill-id":pcb_silkscreen_pill_id,"data-type":"pcb_silkscreen_pill","data-pcb-layer":layer},value:"",children:[]}]}function createSvgObjectsFromPcbSilkscreenOval(pcbSilkscreenOval,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,radius_x,radius_y,layer="top",pcb_silkscreen_oval_id,ccw_rotation=0}=pcbSilkscreenOval;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof radius_x!="number"||typeof radius_y!="number")return debugPcb(`[pcb_silkscreen_oval] Invalid data for "${pcb_silkscreen_oval_id}": expected center {x: number, y: number}, radius_x: number, radius_y: number, got center=${JSON.stringify(center2)}, radius_x=${JSON.stringify(radius_x)}, radius_y=${JSON.stringify(radius_y)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedRadiusX=radius_x*Math.abs(transform6.a),transformedRadiusY=radius_y*Math.abs(transform6.d),color=layer==="bottom"?colorMap2.silkscreen.bottom:colorMap2.silkscreen.top;return[{name:"ellipse",type:"element",attributes:{cx:transformedX.toString(),cy:transformedY.toString(),rx:transformedRadiusX.toString(),ry:transformedRadiusY.toString(),fill:"none",stroke:color,"stroke-width":(.1*Math.abs(transform6.a)).toString(),class:`pcb-silkscreen-oval pcb-silkscreen-${layer}`,"data-pcb-silkscreen-oval-id":pcb_silkscreen_oval_id,"data-type":"pcb_silkscreen_oval","data-pcb-layer":layer,...ccw_rotation!==0&&{transform:`rotate(${-ccw_rotation} ${transformedX} ${transformedY})`}},value:"",children:[]}]}function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,width,height,layer="top",pcb_courtyard_rect_id,ccw_rotation=0}=pcbCourtyardRect;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof width!="number"||typeof height!="number")return debugPcb(`[pcb_courtyard_rect] Invalid data for "${pcb_courtyard_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center2)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedWidth=width*Math.abs(transform6.a),transformedHeight=height*Math.abs(transform6.d),transformedStrokeWidth=.05*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.courtyard.bottom:colorMap2.courtyard.top,attributes2={x:(-transformedWidth/2).toString(),y:(-transformedHeight/2).toString(),width:transformedWidth.toString(),height:transformedHeight.toString(),class:`pcb-courtyard-rect pcb-courtyard-${layer}`,"data-pcb-courtyard-rect-id":pcb_courtyard_rect_id,"data-type":"pcb_courtyard_rect","data-pcb-layer":layer,"stroke-linejoin":"round"};return typeof ccw_rotation=="number"&&ccw_rotation!==0?attributes2.transform=`translate(${transformedX} ${transformedY}) rotate(${-ccw_rotation})`:(attributes2.x=(transformedX-transformedWidth/2).toString(),attributes2.y=(transformedY-transformedHeight/2).toString()),attributes2.fill="none",attributes2.stroke=color,attributes2["stroke-width"]=transformedStrokeWidth.toString(),[{name:"rect",type:"element",attributes:attributes2,value:"",children:[]}]}function createSvgObjectsFromPcbCourtyardPolygon(pcbCourtyardPolygon,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{layer="top",pcb_courtyard_polygon_id,points,color}=pcbCourtyardPolygon;if(layerFilter&&layer!==layerFilter)return[];if(!points||points.length===0)return debugPcb(`[pcb_courtyard_polygon] Invalid data for "${pcb_courtyard_polygon_id}": expected non-empty array of points, got ${JSON.stringify(points)}`),[];let pointsString=points.map(p4=>applyToPoint3(transform6,[p4.x,p4.y])).map(p4=>`${p4[0]},${p4[1]}`).join(" "),transformedStrokeWidth=.05*Math.abs(transform6.a),strokeColor=color??(layer==="bottom"?colorMap2.courtyard.bottom:colorMap2.courtyard.top);return[{name:"polygon",type:"element",attributes:{points:pointsString,class:`pcb-courtyard-polygon pcb-courtyard-${layer}`,"data-pcb-courtyard-polygon-id":pcb_courtyard_polygon_id,"data-type":"pcb_courtyard_polygon","data-pcb-layer":layer,fill:"none",stroke:strokeColor,"stroke-width":transformedStrokeWidth.toString(),"stroke-linejoin":"round"},value:"",children:[]}]}function createSvgObjectsFromPcbCourtyardOutline(pcbCourtyardOutline,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{layer,pcb_courtyard_outline_id,outline}=pcbCourtyardOutline;if(layerFilter&&layer!==layerFilter)return[];if(!outline||outline.length===0)return debugPcb(`[pcb_courtyard_outline] Invalid data for "${pcb_courtyard_outline_id}": expected non-empty array of points, got ${JSON.stringify(outline)}`),[];let pointsString=outline.map(p4=>applyToPoint3(transform6,[p4.x,p4.y])).map(p4=>`${p4[0]},${p4[1]}`).join(" "),transformedStrokeWidth=.05*Math.abs(transform6.a),strokeColor=layer==="bottom"?colorMap2.courtyard.bottom:colorMap2.courtyard.top;return[{name:"polygon",type:"element",attributes:{points:pointsString,class:`pcb-courtyard-outline pcb-courtyard-${layer}`,"data-pcb-courtyard-outline-id":pcb_courtyard_outline_id,"data-type":"pcb_courtyard_outline","data-pcb-layer":layer,fill:"none",stroke:strokeColor,"stroke-width":transformedStrokeWidth.toString(),"stroke-linejoin":"round"},value:"",children:[]}]}function createSvgObjectsFromPcbCourtyardCircle(pcbCourtyardCircle,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx,{center:center2,radius,layer="top",pcb_courtyard_circle_id}=pcbCourtyardCircle;if(layerFilter&&layer!==layerFilter)return[];if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof radius!="number")return console.error(`[pcb_courtyard_circle] Invalid data for "${pcb_courtyard_circle_id}": expected center {x: number, y: number}, radius: number, got center=${JSON.stringify(center2)}, radius=${JSON.stringify(radius)}`),[];let[transformedX,transformedY]=applyToPoint3(transform6,[center2.x,center2.y]),transformedRadius=radius*Math.abs(transform6.a),transformedStrokeWidth=.05*Math.abs(transform6.a),color=layer==="bottom"?colorMap2.courtyard.bottom:colorMap2.courtyard.top,attributes2={cx:transformedX.toString(),cy:transformedY.toString(),r:transformedRadius.toString(),class:`pcb-courtyard-circle pcb-courtyard-${layer}`,"data-pcb-courtyard-circle-id":pcb_courtyard_circle_id,"data-type":"pcb_courtyard_circle","data-pcb-layer":layer};return attributes2.fill="none",attributes2.stroke=color,attributes2["stroke-width"]=transformedStrokeWidth.toString(),[{name:"circle",type:"element",attributes:attributes2,value:"",children:[]}]}function pairs(arr){let result=[];for(let i3=0;i3<arr.length-1;i3++)result.push([arr[i3],arr[i3+1]]);return result}function createSvgObjectsFromPcbTrace(trace,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2,showSolderMask}=ctx;if(!trace.route||!Array.isArray(trace.route)||trace.route.length<2)return[];let segments=pairs(trace.route),svgObjects=[];for(let[start,end]of segments){if(start.is_inside_copper_pour===!0&&end.is_inside_copper_pour===!0)continue;let startPoint=applyToPoint3(transform6,[start.x,start.y]),endPoint=applyToPoint3(transform6,[end.x,end.y]),layer="layer"in start?start.layer:"layer"in end?end.layer:null;if(!layer||layerFilter&&layer!==layerFilter)continue;let maskLayer=layer,copperColor=layerNameToColor(layer,colorMap2),maskColor=colorMap2.soldermaskWithCopperUnderneath[layer],traceWidth="width"in start?start.width:"width"in end?end.width:null,width=traceWidth?(traceWidth*Math.abs(transform6.a)).toString():"0.3";if(showSolderMask){let maskObject={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask",stroke:maskColor,fill:"none",d:`M ${startPoint[0]} ${startPoint[1]} L ${endPoint[0]} ${endPoint[1]}`,"stroke-width":width,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-type":"pcb_trace_soldermask","data-pcb-layer":layer}};svgObjects.push(maskObject)}else{let maskOnlyObject={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-trace",stroke:copperColor,fill:"none",d:`M ${startPoint[0]} ${startPoint[1]} L ${endPoint[0]} ${endPoint[1]}`,"stroke-width":width,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-type":showSolderMask?"pcb_soldermask":"pcb_trace","data-pcb-layer":layer}};svgObjects.push(maskOnlyObject)}}return svgObjects}function createSvgObjectsFromSmtPad(pad2,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2,showSolderMask}=ctx;if(layerFilter&&pad2.layer!==layerFilter)return[];let isCoveredWithSolderMask=!!pad2?.is_covered_with_solder_mask,shouldShowSolderMask=showSolderMask&&isCoveredWithSolderMask,soldermaskWithCopperUnderneathColor=colorMap2.soldermaskWithCopperUnderneath[pad2.layer]??colorMap2.soldermaskWithCopperUnderneath.top,soldermaskMargin=(pad2.soldermask_margin??0)*Math.abs(transform6.a);if(pad2.shape==="rect"||pad2.shape==="rotated_rect"){let width=pad2.width*Math.abs(transform6.a),height=pad2.height*Math.abs(transform6.d),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]),scaledBorderRadius=(pad2.corner_radius??pad2.rect_border_radius??0)*Math.abs(transform6.a),m4={left:(pad2.soldermask_margin_left??pad2.soldermask_margin??0)*Math.abs(transform6.a),right:(pad2.soldermask_margin_right??pad2.soldermask_margin??0)*Math.abs(transform6.a),top:(pad2.soldermask_margin_top??pad2.soldermask_margin??0)*Math.abs(transform6.a),bottom:(pad2.soldermask_margin_bottom??pad2.soldermask_margin??0)*Math.abs(transform6.a)},isNegativeMargin=m4.left<0||m4.right<0||m4.top<0||m4.bottom<0,isZeroMargin=m4.left===0&&m4.right===0&&m4.top===0&&m4.bottom===0;if(pad2.shape==="rotated_rect"&&pad2.ccw_rotation){let padElement2={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),x:(-width/2).toString(),y:(-height/2).toString(),width:width.toString(),height:height.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}};if(!shouldShowSolderMask)return[padElement2];let maskWidth2=width+m4.left+m4.right,maskHeight2=height+m4.top+m4.bottom,maskBorderRadius2=scaledBorderRadius?scaledBorderRadius+soldermaskMargin:0;if(isNegativeMargin){let coveredPadElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:(-width/2).toString(),y:(-height/2).toString(),width:width.toString(),height:height.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}},exposedOpeningElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),x:(-width/2-m4.left).toString(),y:(-height/2-m4.top).toString(),width:maskWidth2.toString(),height:maskHeight2.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer,...maskBorderRadius2>0?{rx:maskBorderRadius2.toString(),ry:maskBorderRadius2.toString()}:{}}};return[coveredPadElement,exposedOpeningElement]}return isZeroMargin?[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:(-width/2).toString(),y:(-height/2).toString(),width:width.toString(),height:height.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}}]:[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(-width/2-m4.left).toString(),y:(-height/2-m4.top).toString(),width:maskWidth2.toString(),height:maskHeight2.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,...maskBorderRadius2>0?{rx:maskBorderRadius2.toString(),ry:maskBorderRadius2.toString()}:{},"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer}},padElement2]}let padElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}};if(!shouldShowSolderMask)return[padElement];let maskWidth=width+m4.left+m4.right,maskHeight=height+m4.top+m4.bottom,maskBorderRadius=scaledBorderRadius?scaledBorderRadius+soldermaskMargin:0;if(isNegativeMargin){let coveredPadElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}}},exposedOpeningElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),x:(x4-width/2-m4.left).toString(),y:(y4-height/2-m4.top).toString(),width:maskWidth.toString(),height:maskHeight.toString(),"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer,...maskBorderRadius>0?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{}}};return[coveredPadElement,exposedOpeningElement]}return isZeroMargin?[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),...maskBorderRadius>0?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{},"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}}]:[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(x4-width/2-m4.left).toString(),y:(y4-height/2-m4.top).toString(),width:maskWidth.toString(),height:maskHeight.toString(),...maskBorderRadius>0?{rx:maskBorderRadius.toString(),ry:maskBorderRadius.toString()}:{},"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer}},padElement]}if(pad2.shape==="pill"||pad2.shape==="rotated_pill"){let isRotated=pad2.shape==="rotated_pill",width=pad2.width*Math.abs(transform6.a),height=pad2.height*Math.abs(transform6.d),radius=pad2.radius*Math.abs(transform6.a),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]),rotationTransformAttributes=isRotated?{transform:`translate(${x4} ${y4}) rotate(${-(pad2.ccw_rotation??0)})`}:void 0,baseAttributes={class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),x:isRotated?(-width/2).toString():(x4-width/2).toString(),y:isRotated?(-height/2).toString():(y4-height/2).toString(),width:width.toString(),height:height.toString(),rx:radius.toString(),ry:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}},padElement={name:"rect",type:"element",value:"",children:[],attributes:baseAttributes};if(!shouldShowSolderMask)return[padElement];let maskWidth=width+2*soldermaskMargin,maskHeight=height+2*soldermaskMargin,maskRadius=radius+soldermaskMargin;if(soldermaskMargin<0){let coveredPadElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:isRotated?(-width/2).toString():(x4-width/2).toString(),y:isRotated?(-height/2).toString():(y4-height/2).toString(),width:width.toString(),height:height.toString(),rx:radius.toString(),ry:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}}},exposedAttributes={class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),x:isRotated?(-maskWidth/2).toString():(x4-maskWidth/2).toString(),y:isRotated?(-maskHeight/2).toString():(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),rx:maskRadius.toString(),ry:maskRadius.toString(),"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}};return[coveredPadElement,{name:"rect",type:"element",value:"",children:[],attributes:exposedAttributes}]}if(soldermaskMargin===0)return[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,x:isRotated?(-width/2).toString():(x4-width/2).toString(),y:isRotated?(-height/2).toString():(y4-height/2).toString(),width:width.toString(),height:height.toString(),rx:radius.toString(),ry:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}}}];let substrateAttributes={class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:isRotated?(-maskWidth/2).toString():(x4-maskWidth/2).toString(),y:isRotated?(-maskHeight/2).toString():(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),rx:maskRadius.toString(),ry:maskRadius.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer,...rotationTransformAttributes??{}};return[{name:"rect",type:"element",value:"",children:[],attributes:substrateAttributes},padElement]}if(pad2.shape==="circle"){let radius=pad2.radius*Math.abs(transform6.a),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]),padElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}};if(!shouldShowSolderMask)return[padElement];let maskRadius=radius+soldermaskMargin;if(soldermaskMargin<0){let coveredPadElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}},exposedOpeningElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer}};return[coveredPadElement,exposedOpeningElement]}return soldermaskMargin===0?[{name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}}]:[{name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer}},padElement]}if(pad2.shape==="polygon"){let points=(pad2.points??[]).map(point7=>applyToPoint3(transform6,[point7.x,point7.y])),padElement={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:layerNameToColor(pad2.layer,colorMap2),points:points.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}};if(!shouldShowSolderMask)return[padElement];let maskPoints=points;if(soldermaskMargin!==0){let centroidX=points.reduce((sum,p4)=>sum+p4[0],0)/points.length,centroidY=points.reduce((sum,p4)=>sum+p4[1],0)/points.length;maskPoints=points.map(([px3,py3])=>{let dx3=px3-centroidX,dy3=py3-centroidY,distance62=Math.sqrt(dx3*dx3+dy3*dy3);if(distance62===0)return[px3,py3];let normalizedDx=dx3/distance62,normalizedDy=dy3/distance62;return[px3+normalizedDx*soldermaskMargin,py3+normalizedDy*soldermaskMargin]})}if(soldermaskMargin<0){let coveredPadElement={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,points:points.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}},exposedOpeningElement={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad-exposed",fill:layerNameToColor(pad2.layer,colorMap2),points:maskPoints.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_soldermask","data-pcb-layer":pad2.layer}};return[coveredPadElement,exposedOpeningElement]}return soldermaskMargin===0?[{name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad-covered",fill:soldermaskWithCopperUnderneathColor,points:points.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_smtpad","data-pcb-layer":pad2.layer}}]:[{name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,points:maskPoints.map(p4=>p4.join(",")).join(" "),"data-type":"pcb_soldermask_opening","data-pcb-layer":pad2.layer}},padElement]}return[]}function createAnchorOffsetIndicators(params){let{groupAnchorPosition,componentPosition,transform:transform6,componentWidth=0,componentHeight=0,displayXOffset,displayYOffset}=params,objects=[],[screenGroupAnchorX,screenGroupAnchorY]=applyToPoint3(transform6,[groupAnchorPosition.x,groupAnchorPosition.y]),[screenComponentX,screenComponentY]=applyToPoint3(transform6,[componentPosition.x,componentPosition.y]),offsetX=componentPosition.x-groupAnchorPosition.x,offsetY=componentPosition.y-groupAnchorPosition.y,scale10=Math.abs(transform6.a),screenComponentWidth=componentWidth*scale10,screenComponentHeight=componentHeight*scale10;objects.push(createAnchorMarker(screenGroupAnchorX,screenGroupAnchorY));let trimmedConnector=getTrimmedConnectorLine(screenGroupAnchorX,screenGroupAnchorY,screenComponentX,screenComponentY);objects.push({name:"line",type:"element",attributes:{x1:trimmedConnector.x1.toString(),y1:trimmedConnector.y1.toString(),x2:trimmedConnector.x2.toString(),y2:trimmedConnector.y2.toString(),stroke:"#ffffff","stroke-width":"0.5","stroke-dasharray":"3,3",opacity:"0.5",class:"anchor-offset-connector"},children:[],value:""}),objects.push({name:"circle",type:"element",attributes:{cx:screenComponentX.toString(),cy:screenComponentY.toString(),r:COMPONENT_ANCHOR_MARKER_RADIUS_PX.toString(),fill:"#ffffff",opacity:"0.7",class:"anchor-offset-component-marker"},children:[],value:""});let yDistance=Math.abs(screenComponentY-screenGroupAnchorY),xDistance=Math.abs(screenComponentX-screenGroupAnchorX),totalDistance=Math.sqrt(xDistance*xDistance+yDistance*yDistance),componentHeightOffset=screenComponentHeight/2+COMPONENT_GAP_PX,dynamicOffset=Math.max(componentHeightOffset,Math.min(MAX_OFFSET_PX,totalDistance*DISTANCE_MULTIPLIER)),horizontalLineY=offsetY>0?screenComponentY-dynamicOffset:screenComponentY+dynamicOffset,componentWidthOffset=screenComponentWidth/2+COMPONENT_SIDE_GAP_PX,verticalLineX=offsetX>0?screenComponentX+componentWidthOffset:screenComponentX-componentWidthOffset;if(isTooCloseToAnchor(horizontalLineY,screenGroupAnchorY)||isTooCloseToAnchor(horizontalLineY,screenComponentY)){let minY=Math.min(screenGroupAnchorY,screenComponentY),maxY=Math.max(screenGroupAnchorY,screenComponentY),candidateAbove=minY-DIMENSION_ANCHOR_CLEARANCE_PX,candidateBelow=maxY+DIMENSION_ANCHOR_CLEARANCE_PX;horizontalLineY=Math.abs(horizontalLineY-candidateAbove)<Math.abs(horizontalLineY-candidateBelow)?candidateAbove:candidateBelow}if(isTooCloseToAnchor(verticalLineX,screenGroupAnchorX)||isTooCloseToAnchor(verticalLineX,screenComponentX)){let minX=Math.min(screenGroupAnchorX,screenComponentX),maxX=Math.max(screenGroupAnchorX,screenComponentX),candidateLeft=minX-DIMENSION_ANCHOR_CLEARANCE_PX,candidateRight=maxX+DIMENSION_ANCHOR_CLEARANCE_PX;verticalLineX=Math.abs(verticalLineX-candidateLeft)<Math.abs(verticalLineX-candidateRight)?candidateLeft:candidateRight}return Math.abs(offsetX)>OFFSET_THRESHOLD_MM&&objects.push(...createHorizontalDimension({startX:screenGroupAnchorX,endX:screenComponentX,y:horizontalLineY,offsetMm:offsetX,offsetY,displayOffset:displayXOffset})),Math.abs(offsetY)>OFFSET_THRESHOLD_MM&&objects.push(...createVerticalDimension({x:verticalLineX,startY:screenGroupAnchorY,endY:screenComponentY,offsetMm:offsetY,offsetX,displayOffset:displayYOffset})),objects}function getTrimmedConnectorLine(x12,y12,x22,y22){let dx3=x22-x12,dy3=y22-y12,distance62=Math.hypot(dx3,dy3),totalTrim=CONNECTOR_GROUP_GAP_PX+CONNECTOR_COMPONENT_GAP_PX;if(!(distance62>totalTrim))return{x1:x12,y1:y12,x2:x22,y2:y22};let ux3=dx3/distance62,uy3=dy3/distance62;return{x1:x12+ux3*CONNECTOR_GROUP_GAP_PX,y1:y12+uy3*CONNECTOR_GROUP_GAP_PX,x2:x22-ux3*CONNECTOR_COMPONENT_GAP_PX,y2:y22-uy3*CONNECTOR_COMPONENT_GAP_PX}}function isTooCloseToAnchor(value,anchorValue){return Math.abs(value-anchorValue)<DIMENSION_ANCHOR_CLEARANCE_PX}function createAnchorMarker(x4,y4){return{name:"g",type:"element",attributes:{class:"anchor-offset-marker","data-type":"anchor_offset_marker"},children:[{name:"line",type:"element",attributes:{x1:x4.toString(),y1:(y4-ANCHOR_MARKER_SIZE_PX).toString(),x2:x4.toString(),y2:(y4+ANCHOR_MARKER_SIZE_PX).toString(),stroke:"#ffffff","stroke-width":ANCHOR_MARKER_STROKE_WIDTH_PX.toString(),"stroke-linecap":"round"},children:[],value:""},{name:"line",type:"element",attributes:{x1:(x4-ANCHOR_MARKER_SIZE_PX).toString(),y1:y4.toString(),x2:(x4+ANCHOR_MARKER_SIZE_PX).toString(),y2:y4.toString(),stroke:"#ffffff","stroke-width":ANCHOR_MARKER_STROKE_WIDTH_PX.toString(),"stroke-linecap":"round"},children:[],value:""}],value:""}}function createHorizontalDimension({startX,endX,y:y4,offsetMm,offsetY,displayOffset}){let objects=[];objects.push({name:"line",type:"element",attributes:{x1:startX.toString(),y1:y4.toString(),x2:endX.toString(),y2:y4.toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString(),class:"anchor-offset-dimension-x"},children:[],value:""}),objects.push({name:"line",type:"element",attributes:{x1:startX.toString(),y1:(y4-TICK_SIZE_PX).toString(),x2:startX.toString(),y2:(y4+TICK_SIZE_PX).toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString()},children:[],value:""}),objects.push({name:"line",type:"element",attributes:{x1:endX.toString(),y1:(y4-TICK_SIZE_PX).toString(),x2:endX.toString(),y2:(y4+TICK_SIZE_PX).toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString()},children:[],value:""});let midX=(startX+endX)/2,labelY=offsetY>0?y4-TICK_SIZE_PX-LABEL_GAP_PX:y4+TICK_SIZE_PX+LABEL_GAP_PX;return objects.push({name:"text",type:"element",attributes:{x:midX.toString(),y:labelY.toString(),fill:"#ffffff","font-size":LABEL_FONT_SIZE_PX.toString(),"font-family":"Arial, sans-serif","text-anchor":"middle","dominant-baseline":offsetY>0?"baseline":"hanging",class:"anchor-offset-label"},children:[{type:"text",value:formatOffsetLabel("X",offsetMm,displayOffset),name:"",attributes:{},children:[]}],value:""}),objects}function createVerticalDimension({x:x4,startY,endY,offsetMm,offsetX,displayOffset}){let objects=[];objects.push({name:"line",type:"element",attributes:{x1:x4.toString(),y1:startY.toString(),x2:x4.toString(),y2:endY.toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString(),class:"anchor-offset-dimension-y"},children:[],value:""}),objects.push({name:"line",type:"element",attributes:{x1:(x4-TICK_SIZE_PX).toString(),y1:startY.toString(),x2:(x4+TICK_SIZE_PX).toString(),y2:startY.toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString()},children:[],value:""}),objects.push({name:"line",type:"element",attributes:{x1:(x4-TICK_SIZE_PX).toString(),y1:endY.toString(),x2:(x4+TICK_SIZE_PX).toString(),y2:endY.toString(),stroke:"#ffffff","stroke-width":STROKE_WIDTH_PX.toString()},children:[],value:""});let midY=(startY+endY)/2,labelX=offsetX<0?x4-TICK_SIZE_PX-4:x4+TICK_SIZE_PX+4;return objects.push({name:"text",type:"element",attributes:{x:labelX.toString(),y:midY.toString(),fill:"#ffffff","font-size":LABEL_FONT_SIZE_PX.toString(),"font-family":"Arial, sans-serif","text-anchor":offsetX<0?"end":"start","dominant-baseline":"middle",class:"anchor-offset-label"},children:[{type:"text",value:formatOffsetLabel("Y",offsetMm,displayOffset),name:"",attributes:{},children:[]}],value:""}),objects}function formatOffsetLabel(axis,offsetMm,displayOffset){let valueStr=typeof displayOffset=="string"?displayOffset:offsetMm.toFixed(2),unitSuffix=typeof valueStr=="string"&&valueStr.trim().endsWith("mm")?"":"mm";return`${axis}: ${valueStr}${unitSuffix}`}function getPointFromElm(elm){let candidate=elm?.anchor_position??elm?.center;if(candidate&&typeof candidate.x=="number"&&typeof candidate.y=="number")return{x:candidate.x,y:candidate.y}}function createSvgObjectsFromPcbBoard(pcbBoard,ctx){let{transform:transform6,colorMap:colorMap2,showSolderMask,circuitJson}=ctx,{width,height,center:center2,outline,position_mode,anchor_position:boardAnchorPosition,display_offset_x,display_offset_y}=pcbBoard,path;if(outline&&Array.isArray(outline)&&outline.length>=3)path=outline.map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ");else{let halfWidth=width/2,halfHeight=height/2,topLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y-halfHeight]),topRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),bottomRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y+halfHeight]),bottomLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]);path=`M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]}`}path+=" Z";let svgObjects=[];if(showSolderMask){let maskLayer=(ctx.layer??"top")==="bottom"?"soldermask-bottom":"soldermask-top";svgObjects.push({name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board-soldermask",d:path,fill:colorMap2.soldermask.top,"fill-opacity":"0.8",stroke:"none","data-type":"pcb_soldermask","data-pcb-layer":maskLayer}})}if(svgObjects.push({name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:path,fill:"none",stroke:colorMap2.boardOutline,"stroke-width":(.1*Math.abs(transform6.a)).toString(),"data-type":"pcb_board","data-pcb-layer":"board"}}),ctx.showAnchorOffsets&&circuitJson&&position_mode==="relative_to_panel_anchor"){let panel=circuitJson.find(elm=>elm.type==="pcb_panel");if(panel){let panelAnchorPosition=getPointFromElm(panel);panelAnchorPosition&&svgObjects.push(...createAnchorOffsetIndicators({groupAnchorPosition:panelAnchorPosition,componentPosition:boardAnchorPosition??center2,transform:transform6,componentWidth:width,componentHeight:height,displayXOffset:display_offset_x,displayYOffset:display_offset_y}))}}return svgObjects}function createSvgObjectsFromPcbPanel(pcbPanel,ctx){let{transform:transform6,colorMap:colorMap2,showSolderMask}=ctx,width=Number(pcbPanel.width),height=Number(pcbPanel.height),center2=pcbPanel.center??{x:width/2,y:height/2},halfWidth=width/2,halfHeight=height/2,topLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y-halfHeight]),topRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),bottomRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y+halfHeight]),bottomLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]),path=`M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]} Z`,isCoveredWithSolderMask=pcbPanel.covered_with_solder_mask!==!1,shouldShowSolderMask=!!(showSolderMask&&isCoveredWithSolderMask);return[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-panel",d:path,fill:"none",stroke:colorMap2.boardOutline,"stroke-width":(.1*Math.abs(transform6.a)).toString(),"data-type":"pcb_panel","data-pcb-layer":"board"}}]}function createSvgObjectsFromPcbVia(hole,ctx){let{transform:transform6,colorMap:colorMap2}=ctx,[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]),scaledOuterWidth=hole.outer_diameter*Math.abs(transform6.a),scaledOuterHeight=hole.outer_diameter*Math.abs(transform6.a),scaledHoleWidth=hole.hole_diameter*Math.abs(transform6.a),scaledHoleHeight=hole.hole_diameter*Math.abs(transform6.a),outerRadius=Math.min(scaledOuterWidth,scaledOuterHeight)/2,innerRadius=Math.min(scaledHoleWidth,scaledHoleHeight)/2;return{name:"g",type:"element",attributes:{"data-type":"pcb_via","data-pcb-layer":"through"},children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:colorMap2.copper.top,cx:x4.toString(),cy:y4.toString(),r:outerRadius.toString(),"data-type":"pcb_via","data-pcb-layer":"top"}},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:colorMap2.drill,cx:x4.toString(),cy:y4.toString(),r:innerRadius.toString(),"data-type":"pcb_via","data-pcb-layer":"drill"}}]}}function createSvgObjectsFromPcbHole(hole,ctx){let{transform:transform6,colorMap:colorMap2,showSolderMask}=ctx,layer=ctx.layer??"top",[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]),isCoveredWithSolderMask=!!hole.is_covered_with_solder_mask,soldermaskMargin=(hole.soldermask_margin??0)*Math.abs(transform6.a),shouldShowSolderMask=showSolderMask&&isCoveredWithSolderMask&&soldermaskMargin!==0,solderMaskColor=colorMap2.soldermask.top;if(hole.hole_shape==="circle"||hole.hole_shape==="square"){let scaledDiameter=hole.hole_diameter*Math.abs(transform6.a),radius=scaledDiameter/2;if(hole.hole_shape==="circle"){let holeElement2={name:"circle",type:"element",attributes:{class:"pcb-hole",cx:x4.toString(),cy:y4.toString(),r:radius.toString(),fill:colorMap2.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement2];let maskRadius=radius+soldermaskMargin;if(soldermaskMargin<0){let coveredElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,cx:x4.toString(),cy:y4.toString(),r:maskRadius.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement2]}let holeElement={name:"rect",type:"element",attributes:{class:"pcb-hole",x:(x4-radius).toString(),y:(y4-radius).toString(),width:scaledDiameter.toString(),height:scaledDiameter.toString(),fill:colorMap2.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskDiameter=scaledDiameter+2*soldermaskMargin;if(soldermaskMargin<0){let coveredElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,x:(x4-radius).toString(),y:(y4-radius).toString(),width:scaledDiameter.toString(),height:scaledDiameter.toString(),"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,x:(x4-maskDiameter/2).toString(),y:(y4-maskDiameter/2).toString(),width:maskDiameter.toString(),height:maskDiameter.toString(),"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(x4-maskDiameter/2).toString(),y:(y4-maskDiameter/2).toString(),width:maskDiameter.toString(),height:maskDiameter.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}if(hole.hole_shape==="oval"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),rx3=scaledWidth/2,ry3=scaledHeight/2,holeElement={name:"ellipse",type:"element",attributes:{class:"pcb-hole",cx:x4.toString(),cy:y4.toString(),rx:rx3.toString(),ry:ry3.toString(),fill:colorMap2.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskRx=rx3+soldermaskMargin,maskRy=ry3+soldermaskMargin;if(soldermaskMargin<0){let coveredElement={name:"ellipse",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,cx:x4.toString(),cy:y4.toString(),rx:rx3.toString(),ry:ry3.toString(),"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"ellipse",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,cx:x4.toString(),cy:y4.toString(),rx:maskRx.toString(),ry:maskRy.toString(),"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"ellipse",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,cx:x4.toString(),cy:y4.toString(),rx:maskRx.toString(),ry:maskRy.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}if(hole.hole_shape==="rect"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),holeElement={name:"rect",type:"element",attributes:{class:"pcb-hole",x:(x4-scaledWidth/2).toString(),y:(y4-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),fill:colorMap2.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskWidth=scaledWidth+2*soldermaskMargin,maskHeight=scaledHeight+2*soldermaskMargin;if(soldermaskMargin<0){let coveredElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,x:(x4-scaledWidth/2).toString(),y:(y4-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,x:(x4-maskWidth/2).toString(),y:(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,x:(x4-maskWidth/2).toString(),y:(y4-maskHeight/2).toString(),width:maskWidth.toString(),height:maskHeight.toString(),"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}if(hole.hole_shape==="pill"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),isHorizontal3=scaledWidth>scaledHeight,radius=Math.min(scaledWidth,scaledHeight)/2,straightLength=Math.abs(isHorizontal3?scaledWidth-scaledHeight:scaledHeight-scaledWidth),pathD=isHorizontal3?`M${x4-straightLength/2},${y4-radius} h${straightLength} a${radius},${radius} 0 0 1 0,${scaledHeight} h-${straightLength} a${radius},${radius} 0 0 1 0,-${scaledHeight} z`:`M${x4-radius},${y4-straightLength/2} v${straightLength} a${radius},${radius} 0 0 0 ${scaledWidth},0 v-${straightLength} a${radius},${radius} 0 0 0 -${scaledWidth},0 z`,holeElement={name:"path",type:"element",attributes:{class:"pcb-hole",fill:colorMap2.drill,d:pathD,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskWidth=scaledWidth+2*soldermaskMargin,maskHeight=scaledHeight+2*soldermaskMargin,maskIsHorizontal=maskWidth>maskHeight,maskRadius=Math.min(maskWidth,maskHeight)/2,maskStraightLength=Math.abs(maskIsHorizontal?maskWidth-maskHeight:maskHeight-maskWidth),maskPathD=maskIsHorizontal?`M${x4-maskStraightLength/2},${y4-maskRadius} h${maskStraightLength} a${maskRadius},${maskRadius} 0 0 1 0,${maskHeight} h-${maskStraightLength} a${maskRadius},${maskRadius} 0 0 1 0,-${maskHeight} z`:`M${x4-maskRadius},${y4-maskStraightLength/2} v${maskStraightLength} a${maskRadius},${maskRadius} 0 0 0 ${maskWidth},0 v-${maskStraightLength} a${maskRadius},${maskRadius} 0 0 0 -${maskWidth},0 z`;if(soldermaskMargin<0){let coveredElement={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,d:pathD,"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,d:maskPathD,"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,d:maskPathD,"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}if(hole.hole_shape==="rotated_pill"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),rotation5="ccw_rotation"in hole?hole.ccw_rotation??0:0,isHorizontal3=scaledWidth>scaledHeight,radius=Math.min(scaledWidth,scaledHeight)/2,straightLength=Math.abs(isHorizontal3?scaledWidth-scaledHeight:scaledHeight-scaledWidth),pathD=isHorizontal3?`M${-straightLength/2},${-radius} h${straightLength} a${radius},${radius} 0 0 1 0,${scaledHeight} h-${straightLength} a${radius},${radius} 0 0 1 0,-${scaledHeight} z`:`M${-radius},${-straightLength/2} v${straightLength} a${radius},${radius} 0 0 0 ${scaledWidth},0 v-${straightLength} a${radius},${radius} 0 0 0 -${scaledWidth},0 z`,holeElement={name:"path",type:"element",attributes:{class:"pcb-hole",fill:colorMap2.drill,d:pathD,transform:`translate(${x4} ${y4}) rotate(${-rotation5})`,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""};if(!shouldShowSolderMask)return[holeElement];let maskWidth=scaledWidth+2*soldermaskMargin,maskHeight=scaledHeight+2*soldermaskMargin,maskIsHorizontal=maskWidth>maskHeight,maskRadius=Math.min(maskWidth,maskHeight)/2,maskStraightLength=Math.abs(maskIsHorizontal?maskWidth-maskHeight:maskHeight-maskWidth),maskPathD=maskIsHorizontal?`M${-maskStraightLength/2},${-maskRadius} h${maskStraightLength} a${maskRadius},${maskRadius} 0 0 1 0,${maskHeight} h-${maskStraightLength} a${maskRadius},${maskRadius} 0 0 1 0,-${maskHeight} z`:`M${-maskRadius},${-maskStraightLength/2} v${maskStraightLength} a${maskRadius},${maskRadius} 0 0 0 ${maskWidth},0 v-${maskStraightLength} a${maskRadius},${maskRadius} 0 0 0 -${maskWidth},0 z`;if(soldermaskMargin<0){let coveredElement={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-hole-covered",fill:solderMaskColor,d:pathD,transform:`translate(${x4} ${y4}) rotate(${-rotation5})`,"data-type":"pcb_hole","data-pcb-layer":"drill"}},exposedElement={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-hole-exposed",fill:colorMap2.drill,d:maskPathD,transform:`translate(${x4} ${y4}) rotate(${-rotation5})`,"data-type":"pcb_soldermask","data-pcb-layer":"drill"}};return[coveredElement,exposedElement]}return[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask-cutout",fill:colorMap2.substrate,d:maskPathD,"data-type":"pcb_soldermask_opening","data-pcb-layer":layer}},holeElement]}return[]}function createSvgObjectsForRatsNest(circuitJson,ctx){let{transform:transform6}=ctx,connectivity=getFullConnectivityMapFromCircuitJson(circuitJson),pcbPorts=circuitJson.filter(elm=>elm.type==="pcb_port"),sourceTraces=circuitJson.filter(elm=>elm.type==="source_trace"),ratsNestLines=[];pcbPorts.forEach((port,index)=>{let portId=port.pcb_port_id;if(!portId)return;let netId=connectivity.getNetConnectedToId(portId);if(!netId)return;let isInNet=!1,sourcePort=su2(circuitJson).source_port.getWhere({pcb_port_id:portId});if(sourcePort&&sourcePort.source_port_id){let sourcePortId=sourcePort.source_port_id;for(let trace of sourceTraces)if(Array.isArray(trace.connected_source_port_ids)&&trace.connected_source_port_ids.includes(sourcePortId)&&Array.isArray(trace.connected_source_net_ids)&&trace.connected_source_net_ids.length>0){isInNet=!0;break}}let startPoint={x:port.x,y:port.y},nearestPoint=findNearestPointInNet(startPoint,netId,connectivity,circuitJson);nearestPoint&&ratsNestLines.push({key:`${portId}-${index}`,startPoint,endPoint:nearestPoint,isInNet})});let svgObjects=[];for(let line2 of ratsNestLines){let transformedStart=applyToPoint3(transform6,[line2.startPoint.x,line2.startPoint.y]),transformedEnd=applyToPoint3(transform6,[line2.endPoint.x,line2.endPoint.y]),attributes2={x1:transformedStart[0].toString(),y1:transformedStart[1].toString(),x2:transformedEnd[0].toString(),y2:transformedEnd[1].toString(),stroke:"white","stroke-width":"1","stroke-dasharray":"6,6","data-type":"pcb_rats_nest","data-pcb-layer":"overlay"};svgObjects.push({name:"line",type:"element",attributes:attributes2,value:"",children:[]})}return svgObjects}function createSvgObjectsFromPcbCutout(cutout,ctx){let{transform:transform6,colorMap:colorMap2}=ctx;if(cutout.shape==="rect"){let rectCutout=cutout,[cx3,cy3]=applyToPoint3(transform6,[rectCutout.center.x,rectCutout.center.y]),scaledWidth=rectCutout.width*Math.abs(transform6.a),scaledHeight=rectCutout.height*Math.abs(transform6.d),svgRotation=-(rectCutout.rotation??0),{corner_radius}=rectCutout,baseCornerRadius=typeof corner_radius=="number"&&corner_radius>0?corner_radius:0,transformedCornerRadiusX=baseCornerRadius*Math.abs(transform6.a),transformedCornerRadiusY=baseCornerRadius*Math.abs(transform6.d),attributes2={class:"pcb-cutout pcb-cutout-rect",x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),fill:colorMap2.drill,transform:toString2(compose3(translate3(cx3,cy3),rotate3(svgRotation*Math.PI/180))),"data-type":"pcb_cutout","data-pcb-layer":"drill"};return transformedCornerRadiusX>0&&(attributes2.rx=transformedCornerRadiusX.toString()),transformedCornerRadiusY>0&&(attributes2.ry=transformedCornerRadiusY.toString()),[{name:"rect",type:"element",attributes:attributes2,children:[],value:""}]}if(cutout.shape==="circle"){let circleCutout=cutout,[cx3,cy3]=applyToPoint3(transform6,[circleCutout.center.x,circleCutout.center.y]),scaledRadius=circleCutout.radius*Math.abs(transform6.a);return[{name:"circle",type:"element",attributes:{class:"pcb-cutout pcb-cutout-circle",cx:cx3.toString(),cy:cy3.toString(),r:scaledRadius.toString(),fill:colorMap2.drill,"data-type":"pcb_cutout","data-pcb-layer":"drill"},children:[],value:""}]}if(cutout.shape==="polygon"){let polygonCutout=cutout;return!polygonCutout.points||polygonCutout.points.length===0?[]:[{name:"polygon",type:"element",attributes:{class:"pcb-cutout pcb-cutout-polygon",points:polygonCutout.points.map(p4=>applyToPoint3(transform6,[p4.x,p4.y])).map(p4=>`${p4[0]},${p4[1]}`).join(" "),fill:colorMap2.drill,"data-type":"pcb_cutout","data-pcb-layer":"drill"},children:[],value:""}]}return[]}function createSvgObjectsFromPcbCutoutPath(cutoutPath,ctx){let{transform:transform6,colorMap:colorMap2}=ctx;if(!cutoutPath.route||!Array.isArray(cutoutPath.route))return[];let firstPoint=cutoutPath.route[0],lastPoint=cutoutPath.route[cutoutPath.route.length-1],isClosed=firstPoint&&lastPoint&&firstPoint.x===lastPoint.x&&firstPoint.y===lastPoint.y;return[{name:"path",type:"element",attributes:{class:"pcb-cutout pcb-cutout-path",d:cutoutPath.route.slice(0,isClosed?-1:void 0).map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ")+(isClosed?" Z":""),fill:colorMap2.drill,"data-type":"pcb_cutout_path","data-pcb-cutout-id":cutoutPath.pcb_cutout_id,"data-pcb-layer":"drill"},value:"",children:[]}]}function createKeepoutPatternLines(keepoutColor){let patternLines=[];for(let i3=-KEEPOUT_PATTERN_SIZE;i3<=KEEPOUT_PATTERN_SIZE;i3+=KEEPOUT_LINE_SPACING)patternLines.push({name:"line",type:"element",value:"",attributes:{x1:i3.toString(),y1:"0",x2:(i3+KEEPOUT_PATTERN_SIZE).toString(),y2:KEEPOUT_PATTERN_SIZE.toString(),stroke:keepoutColor,"stroke-width":"1"},children:[]});return patternLines}function createKeepoutPatternDefs(keepoutColor){return{name:"defs",type:"element",value:"",attributes:{},children:[{name:"pattern",type:"element",value:"",attributes:{id:KEEPOUT_PATTERN_ID,width:KEEPOUT_PATTERN_SIZE.toString(),height:KEEPOUT_PATTERN_SIZE.toString(),patternUnits:"userSpaceOnUse"},children:createKeepoutPatternLines(keepoutColor)}]}}function createKeepoutBaseAttributes(keepoutId,layer,shapeClass,description){let attributes2={class:`pcb-keepout ${shapeClass} pcb-keepout-background`,"data-type":"pcb_keepout","data-pcb-layer":layer,"data-pcb-keepout-id":keepoutId,stroke:"none"};return description&&(attributes2["data-description"]=description),attributes2}function createKeepoutPatternAttributes(keepoutId,layer,shapeClass,description){let attributes2={class:`pcb-keepout ${shapeClass} pcb-keepout-pattern`,fill:`url(#${KEEPOUT_PATTERN_ID})`,"data-type":"pcb_keepout","data-pcb-layer":layer,"data-pcb-keepout-id":keepoutId,stroke:"none"};return description&&(attributes2["data-description"]=description),attributes2}function createSvgObjectsFromPcbKeepout(keepout,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2}=ctx;if(layerFilter&&!keepout.layers.includes(layerFilter))return[];let svgObjects=[],keepoutColor=colorMap2.keepout;for(let layer of keepout.layers)if(!(layerFilter&&layer!==layerFilter)){if(keepout.shape==="rect"){let rectKeepout=keepout,[cx3,cy3]=applyToPoint3(transform6,[rectKeepout.center.x,rectKeepout.center.y]),scaledWidth=rectKeepout.width*Math.abs(transform6.a),scaledHeight=rectKeepout.height*Math.abs(transform6.d),baseTransform=toString2(compose3(translate3(cx3,cy3))),backgroundAttributes={...createKeepoutBaseAttributes(rectKeepout.pcb_keepout_id,layer,"pcb-keepout-rect",rectKeepout.description),x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),fill:KEEPOUT_BACKGROUND_COLOR,transform:baseTransform},patternAttributes={...createKeepoutPatternAttributes(rectKeepout.pcb_keepout_id,layer,"pcb-keepout-rect",rectKeepout.description),x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),transform:baseTransform};svgObjects.push({name:"rect",type:"element",attributes:backgroundAttributes,children:[],value:""},{name:"rect",type:"element",attributes:patternAttributes,children:[],value:""})}else if(keepout.shape==="circle"){let circleKeepout=keepout,[cx3,cy3]=applyToPoint3(transform6,[circleKeepout.center.x,circleKeepout.center.y]),scaledRadius=circleKeepout.radius*Math.abs(transform6.a),backgroundAttributes={...createKeepoutBaseAttributes(circleKeepout.pcb_keepout_id,layer,"pcb-keepout-circle",circleKeepout.description),cx:cx3.toString(),cy:cy3.toString(),r:scaledRadius.toString(),fill:KEEPOUT_BACKGROUND_COLOR},patternAttributes={...createKeepoutPatternAttributes(circleKeepout.pcb_keepout_id,layer,"pcb-keepout-circle",circleKeepout.description),cx:cx3.toString(),cy:cy3.toString(),r:scaledRadius.toString()};svgObjects.push({name:"circle",type:"element",attributes:backgroundAttributes,children:[],value:""},{name:"circle",type:"element",attributes:patternAttributes,children:[],value:""})}}return svgObjects}function ringToPathD(vertices,transform6){if(vertices.length===0)return"";let transformedVertices=vertices.map(v4=>{let[x4,y4]=applyToPoint3(transform6,[v4.x,v4.y]);return{...v4,x:x4,y:y4}}),d4=`M ${transformedVertices[0].x} ${transformedVertices[0].y}`;for(let i3=0;i3<transformedVertices.length;i3++){let start=transformedVertices[i3],end=transformedVertices[(i3+1)%transformedVertices.length];if(start.bulge){if(Math.hypot(end.x-start.x,end.y-start.y)<1e-9)continue;let bulge=start.bulge,dx3=end.x-start.x,dy3=end.y-start.y,dist=Math.hypot(dx3,dy3),radius=Math.abs(dist/4/bulge*(bulge*bulge+1)),sweepFlag=bulge<0?1:0,largeArcFlag=Math.abs(bulge)>1?1:0;d4+=` A ${radius} ${radius} 0 ${largeArcFlag} ${sweepFlag} ${end.x} ${end.y}`}else d4+=` L ${end.x} ${end.y}`}return d4+=" Z",d4}function createSoldermaskCutoutElement({elementType,shapeAttributes,layer,colorMap:colorMap2,additionalAttributes}){let baseAttributes={class:"pcb-soldermask-cutout",fill:colorMap2.substrate,"data-type":"pcb_soldermask_opening","data-pcb-layer":layer,...shapeAttributes,...additionalAttributes};return{name:elementType,type:"element",value:"",children:[],attributes:baseAttributes}}function createSoldermaskOverlayElement({elementType,shapeAttributes,layer,fillColor,fillOpacity,className,additionalAttributes}){let baseAttributes={class:className,fill:fillColor,"fill-opacity":fillOpacity,"data-type":"pcb_soldermask","data-pcb-layer":layer,...shapeAttributes,...additionalAttributes};return{name:elementType,type:"element",value:"",children:[],attributes:baseAttributes}}function createSvgObjectsFromPcbCopperPour(pour,ctx){let{transform:transform6,layer:layerFilter,colorMap:colorMap2,showSolderMask}=ctx,{layer}=pour;if(layerFilter&&layer!==layerFilter)return[];let color=layerNameToColor(layer,colorMap2),opacity="0.5",isCoveredWithSolderMask=pour.covered_with_solder_mask!==!1,maskOverlayColor=layer==="bottom"?colorMap2.soldermaskOverCopper.bottom:colorMap2.soldermaskOverCopper.top,maskOverlayOpacity="0.9";if(pour.shape==="rect"){let[cx3,cy3]=applyToPoint3(transform6,[pour.center.x,pour.center.y]),scaledWidth=pour.width*Math.abs(transform6.a),scaledHeight=pour.height*Math.abs(transform6.d),svgRotation=-(pour.rotation??0),rectAttributes={x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),transform:toString2(compose3(translate3(cx3,cy3),rotate3(svgRotation*Math.PI/180)))},copperRect={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-copper-pour pcb-copper-pour-rect",...rectAttributes,fill:color,"fill-opacity":opacity,"data-type":"pcb_copper_pour","data-pcb-layer":layer}},maskRect=showSolderMask?isCoveredWithSolderMask?createSoldermaskOverlayElement({elementType:"rect",shapeAttributes:rectAttributes,layer,fillColor:maskOverlayColor,fillOpacity:maskOverlayOpacity,className:"pcb-soldermask-covered-pour"}):createSoldermaskCutoutElement({elementType:"rect",shapeAttributes:rectAttributes,layer,colorMap:colorMap2}):null;return maskRect?!isCoveredWithSolderMask&&pour.pcb_copper_pour_id?.includes("substrate_only")?[maskRect]:[copperRect,maskRect]:[copperRect]}if(pour.shape==="polygon"){if(!pour.points||pour.points.length===0)return[];let pointsString=pour.points.map(p4=>applyToPoint3(transform6,[p4.x,p4.y])).map(p4=>`${p4[0]},${p4[1]}`).join(" "),copperPolygon={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-copper-pour pcb-copper-pour-polygon",points:pointsString,fill:color,"fill-opacity":opacity,"data-type":"pcb_copper_pour","data-pcb-layer":layer}},maskPolygon=showSolderMask?isCoveredWithSolderMask?createSoldermaskOverlayElement({elementType:"polygon",shapeAttributes:{points:pointsString},layer,fillColor:maskOverlayColor,fillOpacity:maskOverlayOpacity,className:"pcb-soldermask-covered-pour"}):createSoldermaskCutoutElement({elementType:"polygon",shapeAttributes:{points:pointsString},layer,colorMap:colorMap2}):null;return maskPolygon?!isCoveredWithSolderMask&&pour.pcb_copper_pour_id?.includes("substrate_only")?[maskPolygon]:[copperPolygon,maskPolygon]:[copperPolygon]}if(pour.shape==="brep"){let{brep_shape:brep_shape3}=pour,d4=ringToPathD(brep_shape3.outer_ring.vertices,transform6);for(let inner_ring of brep_shape3.inner_rings??[])d4+=` ${ringToPathD(inner_ring.vertices,transform6)}`;let copperPath={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-copper-pour pcb-copper-pour-brep",d:d4,fill:color,"fill-rule":"evenodd","fill-opacity":opacity,"data-type":"pcb_copper_pour","data-pcb-layer":layer}},maskPath=showSolderMask?isCoveredWithSolderMask?createSoldermaskOverlayElement({elementType:"path",shapeAttributes:{d:d4,"fill-rule":"evenodd"},layer,fillColor:maskOverlayColor,fillOpacity:maskOverlayOpacity,className:"pcb-soldermask-covered-pour"}):createSoldermaskCutoutElement({elementType:"path",shapeAttributes:{d:d4,"fill-rule":"evenodd"},layer,colorMap:colorMap2}):null;return maskPath?!isCoveredWithSolderMask&&pour.pcb_copper_pour_id?.includes("substrate_only")?[maskPath]:[copperPath,maskPath]:[copperPath]}return[]}function createSvgObjectsForPcbGrid({grid:grid4,svgWidth,svgHeight}){if(!grid4)return{};let gridLineColor=grid4.lineColor??DEFAULT_GRID_LINE_COLOR,gridCellSize=grid4.cellSize,majorCellSize=grid4.majorCellSize,majorLineColor=grid4.majorLineColor??gridLineColor;if(majorCellSize!==void 0){if(!gridCellSize||gridCellSize<=0)throw new Error("grid.majorCellSize requires a positive grid.cellSize");if(majorCellSize<=0)throw new Error("grid.majorCellSize must be a positive multiple of grid.cellSize");let ratio=majorCellSize/gridCellSize,nearestInteger=Math.round(ratio);if(!Number.isFinite(ratio)||Math.abs(ratio-nearestInteger)>1e-6)throw new Error("grid.majorCellSize must be a positive multiple of grid.cellSize")}if(!gridCellSize||gridCellSize<=0)return{};let hasMajorGrid=majorCellSize!==void 0,patternChildren=hasMajorGrid?createMajorGridPatternChildren(gridCellSize,majorCellSize,gridLineColor,majorLineColor):[{name:"path",type:"element",value:"",attributes:{d:`M ${gridCellSize} 0 L 0 0 0 ${gridCellSize}`,fill:"none",stroke:gridLineColor,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]}],defs={name:"defs",type:"element",value:"",attributes:{},children:[{name:"pattern",type:"element",value:"",attributes:{id:GRID_PATTERN_ID,width:hasMajorGrid?majorCellSize.toString():gridCellSize.toString(),height:hasMajorGrid?majorCellSize.toString():gridCellSize.toString(),patternUnits:"userSpaceOnUse"},children:patternChildren}]},rect={name:"rect",type:"element",value:"",attributes:{x:"0",y:"0",width:svgWidth.toString(),height:svgHeight.toString(),fill:`url(#${GRID_PATTERN_ID})`,"pointer-events":"none","data-type":"pcb_grid","data-pcb-layer":"global"},children:[]};return{defs,rect}}function createMajorGridPatternChildren(cellSize,majorCellSize,lineColor,majorLineColor){let children=[],steps=Math.round(majorCellSize/cellSize);for(let step=0;step<steps;step+=1){let offsetString=Number((step*cellSize).toFixed(6)).toString(),color=step===0?majorLineColor:lineColor,majorSizeString=majorCellSize.toString();children.push({name:"line",type:"element",value:"",attributes:{x1:offsetString,y1:"0",x2:offsetString,y2:majorSizeString,stroke:color,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]}),children.push({name:"line",type:"element",value:"",attributes:{x1:"0",y1:offsetString,x2:majorSizeString,y2:offsetString,stroke:color,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]})}return children}function createSvgObjectsFromPcbComponent(component,ctx){let{transform:transform6,circuitJson}=ctx,{center:center2,width,height,rotation:rotation5=0}=component,[x4,y4]=applyToPoint3(transform6,[center2.x,center2.y]),scaledWidth=width*Math.abs(transform6.a),scaledHeight=height*Math.abs(transform6.d),transformStr=`translate(${x4}, ${y4}) rotate(${-rotation5}) scale(1, -1)`,svgObjects=[];if(ctx.showAnchorOffsets&&circuitJson&&component.position_mode==="relative_to_group_anchor"&&(component.positioned_relative_to_pcb_group_id||component.positioned_relative_to_pcb_board_id)){let parentAnchorPosition=getParentAnchorPosition(component,circuitJson);parentAnchorPosition&&svgObjects.push(...createAnchorOffsetIndicators({groupAnchorPosition:parentAnchorPosition,componentPosition:center2,transform:transform6,componentWidth:width,componentHeight:height,displayXOffset:component.display_offset_x,displayYOffset:component.display_offset_y}))}return!ctx.colorMap.debugComponent?.fill&&!ctx.colorMap.debugComponent?.stroke||svgObjects.push({name:"g",type:"element",attributes:{transform:transformStr,"data-type":"pcb_component","data-pcb-layer":component.layer??"top"},children:[{name:"rect",type:"element",attributes:{class:"pcb-component",x:(-scaledWidth/2).toString(),y:(-scaledHeight/2).toString(),width:scaledWidth.toString(),height:scaledHeight.toString(),fill:ctx.colorMap.debugComponent.fill??"transparent",stroke:ctx.colorMap.debugComponent.stroke??"transparent","data-type":"pcb_component","data-pcb-layer":component.layer??"top"}}],value:""}),svgObjects}function getParentAnchorPosition(component,circuitJson){if(component.positioned_relative_to_pcb_group_id){let pcbGroup=circuitJson.find(elm=>elm.type==="pcb_group"&&elm.pcb_group_id===component.positioned_relative_to_pcb_group_id),point7=getPointFromElm(pcbGroup);if(point7)return point7}if(component.positioned_relative_to_pcb_board_id){let pcbBoard=circuitJson.find(elm=>elm.type==="pcb_board"&&elm.pcb_board_id===component.positioned_relative_to_pcb_board_id),point7=getPointFromElm(pcbBoard);if(point7)return point7}}function createSvgObjectsFromPcbGroup(pcbGroup,ctx){let{transform:transform6,circuitJson}=ctx,{center:center2,width,height}=pcbGroup,svgObjects=[];if(ctx.showAnchorOffsets&&pcbGroup.position_mode==="relative_to_group_anchor"&&circuitJson){let parentAnchorPosition=getParentAnchorPosition2(pcbGroup,circuitJson);parentAnchorPosition&&svgObjects.push(...createAnchorOffsetIndicators({groupAnchorPosition:parentAnchorPosition,componentPosition:pcbGroup.anchor_position??pcbGroup.center,transform:transform6,componentWidth:pcbGroup.width,componentHeight:pcbGroup.height,displayXOffset:pcbGroup.display_offset_x,displayYOffset:pcbGroup.display_offset_y}))}let outline=Array.isArray(pcbGroup.outline)?pcbGroup.outline:void 0,transformedStrokeWidth=DEFAULT_STROKE_WIDTH*Math.abs(transform6.a),dashLength=.3*Math.abs(transform6.a),gapLength=.15*Math.abs(transform6.a),baseAttributes={class:"pcb-group",fill:"none",stroke:getGroupColor(pcbGroup.pcb_group_id),"stroke-width":transformedStrokeWidth.toString(),"stroke-dasharray":`${dashLength} ${gapLength}`,"data-type":"pcb_group","data-pcb-group-id":pcbGroup.pcb_group_id,"data-pcb-layer":"overlay"};if(pcbGroup.name&&(baseAttributes["data-group-name"]=pcbGroup.name),outline&&outline.length>=3&&outline.every(point7=>point7&&typeof point7.x=="number"&&typeof point7.y=="number")){let path=outline.map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ");return svgObjects.push({name:"path",type:"element",value:"",children:[],attributes:{...baseAttributes,d:`${path} Z`}}),svgObjects}if(!center2||typeof center2.x!="number"||typeof center2.y!="number"||typeof width!="number"||typeof height!="number")return debugPcb(`[pcb_group] Invalid data for "${pcbGroup.pcb_group_id}"${pcbGroup.name?` (name: "${pcbGroup.name}")`:""}: expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center2)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`),svgObjects;let halfWidth=width/2,halfHeight=height/2,[topLeftX,topLeftY]=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]),[bottomRightX,bottomRightY]=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),rectX=Math.min(topLeftX,bottomRightX),rectY=Math.min(topLeftY,bottomRightY),rectWidth=Math.abs(bottomRightX-topLeftX),rectHeight=Math.abs(bottomRightY-topLeftY),svgObject={name:"rect",type:"element",value:"",attributes:{...baseAttributes,x:rectX.toString(),y:rectY.toString(),width:rectWidth.toString(),height:rectHeight.toString()},children:[]};return svgObjects.push(svgObject),svgObjects}function getGroupColor(pcbGroupId){let match2=pcbGroupId.match(/(\d+)$/),index=match2?Number.parseInt(match2[1],10):0;return GROUP_COLOR_PALETTE[index%GROUP_COLOR_PALETTE.length]}function getParentAnchorPosition2(group,circuitJson){if(group.positioned_relative_to_pcb_group_id){let pcbGroup=circuitJson.find(elm=>elm.type==="pcb_group"&&elm.pcb_group_id===group.positioned_relative_to_pcb_group_id),point7=getPointFromElm(pcbGroup);if(point7)return point7}if(group.positioned_relative_to_pcb_board_id){let pcbBoard=circuitJson.find(elm=>elm.type==="pcb_board"&&elm.pcb_board_id===group.positioned_relative_to_pcb_board_id),point7=getPointFromElm(pcbBoard);if(point7)return point7}}function getSoftwareUsedString(circuitJson){return circuitJson.find(e5=>e5.type==="project_software_metadata"||e5.type==="source_project_metadata")?.software_used_string}function sortSvgObjectsByPcbLayer(objects){return objects.map((object,index)=>({object,index,layerPriority:getLayerPriority(object.attributes?.["data-pcb-layer"]??void 0),typePriority:getTypePriority(object.attributes?.["data-type"]??void 0)})).sort((a3,b3)=>a3.layerPriority!==b3.layerPriority?a3.layerPriority-b3.layerPriority:a3.typePriority!==b3.typePriority?a3.typePriority-b3.typePriority:a3.index-b3.index).map(({object})=>object)}function getLayerPriority(layer){if(!layer)return 500;let normalized=layer.toLowerCase();if(normalized==="global")return-100;if(normalized==="bottom")return 4;if(normalized==="board")return 2;if(normalized==="soldermask-top"||normalized==="soldermask-bottom")return 3;if(normalized.startsWith("inner")){let match2=normalized.match(/\d+/);return 5+(match2?Number.parseInt(match2[0],10):0)}return normalized==="through"?18:normalized==="top"?17:normalized==="drill"?30:normalized==="overlay"?40:10}function getTypePriority(type){return type?TYPE_PRIORITY[type]??DEFAULT_TYPE_PRIORITY:DEFAULT_TYPE_PRIORITY}function createErrorTextOverlay(circuitJson,dataType="error_text_overlay"){let errorElms=circuitJson.filter(elm=>elm.type.endsWith("_error"));if(errorElms.length===0)return null;let errorMessages=errorElms.map(e5=>e5.message).filter(m4=>!!m4);return errorMessages.length===0?null:{name:"text",type:"element",value:"",attributes:{x:"10",y:"20",fill:"red","font-family":"monospace","font-size":"12px","data-type":dataType,"data-layer":"global"},children:errorMessages.map((msg,i3)=>({name:"tspan",type:"element",value:"",attributes:{x:"10",dy:i3===0?"0":"1.2em"},children:[{type:"text",value:msg,name:"",attributes:{},children:[]}]}))}}function getPcbBoundsFromCircuitJson(circuitJson){let minX=Number.POSITIVE_INFINITY,minY=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY,hasBounds2=!1,boardMinX=Number.POSITIVE_INFINITY,boardMinY=Number.POSITIVE_INFINITY,boardMaxX=Number.NEGATIVE_INFINITY,boardMaxY=Number.NEGATIVE_INFINITY,hasBoardBounds=!1;for(let circuitJsonElm of circuitJson)if(circuitJsonElm.type==="pcb_panel"){let panel=circuitJsonElm,width=distance.parse(panel.width),height=distance.parse(panel.height);if(width===void 0||height===void 0)continue;let center2=panel.center??{x:width/2,y:height/2};updateBounds({center:center2,width,height})}else if(circuitJsonElm.type==="pcb_board")circuitJsonElm.outline&&Array.isArray(circuitJsonElm.outline)&&circuitJsonElm.outline.length>=3?(updateBoundsToIncludeOutline(circuitJsonElm.outline),updateBoardBoundsToIncludeOutline(circuitJsonElm.outline)):"center"in circuitJsonElm&&"width"in circuitJsonElm&&"height"in circuitJsonElm&&(updateBounds({center:circuitJsonElm.center,width:circuitJsonElm.width,height:circuitJsonElm.height}),updateBoardBounds({center:circuitJsonElm.center,width:circuitJsonElm.width,height:circuitJsonElm.height}));else if(circuitJsonElm.type==="pcb_smtpad"){let pad2=circuitJsonElm;if(pad2.shape==="rect"||pad2.shape==="rotated_rect"||pad2.shape==="pill")updateBounds({center:{x:pad2.x,y:pad2.y},width:pad2.width,height:pad2.height});else if(pad2.shape==="circle"){let radius=distance.parse(pad2.radius);radius!==void 0&&updateBounds({center:{x:pad2.x,y:pad2.y},width:radius*2,height:radius*2})}else pad2.shape==="polygon"&&updateTraceBounds(pad2.points)}else if("x"in circuitJsonElm&&"y"in circuitJsonElm)updateBounds({center:{x:circuitJsonElm.x,y:circuitJsonElm.y},width:0,height:0});else if("route"in circuitJsonElm)updateTraceBounds(circuitJsonElm.route);else if(circuitJsonElm.type==="pcb_note_rect"||circuitJsonElm.type==="pcb_fabrication_note_rect")updateBounds({center:circuitJsonElm.center,width:circuitJsonElm.width,height:circuitJsonElm.height});else if(circuitJsonElm.type==="pcb_note_dimension"||circuitJsonElm.type==="pcb_fabrication_note_dimension"){let dimension=circuitJsonElm,{from,to:to3,text,font_size=1,arrow_size,offset_distance,offset_direction}=dimension;if(!from||!to3||!arrow_size)continue;updateBounds({center:from,width:0,height:0}),updateBounds({center:to3,width:0,height:0});let normalize3=v4=>{let l4=Math.hypot(v4.x,v4.y)||1;return{x:v4.x/l4,y:v4.y/l4}},direction2=normalize3({x:to3.x-from.x,y:to3.y-from.y});if(Number.isNaN(direction2.x)||Number.isNaN(direction2.y))continue;let perpendicular={x:-direction2.y,y:direction2.x},hasOffsetDirection=offset_direction&&typeof offset_direction.x=="number"&&typeof offset_direction.y=="number",normalizedOffsetDirection=hasOffsetDirection?normalize3(offset_direction):{x:0,y:0},offsetMagnitude=typeof offset_distance=="number"?offset_distance:0,offsetVector={x:normalizedOffsetDirection.x*offsetMagnitude,y:normalizedOffsetDirection.y*offsetMagnitude},fromOffset={x:from.x+offsetVector.x,y:from.y+offsetVector.y},toOffset={x:to3.x+offsetVector.x,y:to3.y+offsetVector.y};updateBounds({center:fromOffset,width:0,height:0}),updateBounds({center:toOffset,width:0,height:0});let extensionDirection=hasOffsetDirection&&(Math.abs(normalizedOffsetDirection.x)>Number.EPSILON||Math.abs(normalizedOffsetDirection.y)>Number.EPSILON)?normalizedOffsetDirection:perpendicular,extensionLength=offsetMagnitude+arrow_size,fromExtEnd={x:from.x+extensionDirection.x*extensionLength,y:from.y+extensionDirection.y*extensionLength},toExtEnd={x:to3.x+extensionDirection.x*extensionLength,y:to3.y+extensionDirection.y*extensionLength};updateBounds({center:fromExtEnd,width:0,height:0}),updateBounds({center:toExtEnd,width:0,height:0});let arrowHalfWidth=arrow_size/2,fromBase={x:fromOffset.x+direction2.x*arrow_size,y:fromOffset.y+direction2.y*arrow_size},toBase={x:toOffset.x-direction2.x*arrow_size,y:toOffset.y-direction2.y*arrow_size},fromArrowP2={x:fromBase.x+perpendicular.x*arrowHalfWidth,y:fromBase.y+perpendicular.y*arrowHalfWidth},fromArrowP3={x:fromBase.x-perpendicular.x*arrowHalfWidth,y:fromBase.y-perpendicular.y*arrowHalfWidth};updateBounds({center:fromArrowP2,width:0,height:0}),updateBounds({center:fromArrowP3,width:0,height:0});let toArrowP2={x:toBase.x+perpendicular.x*arrowHalfWidth,y:toBase.y+perpendicular.y*arrowHalfWidth},toArrowP3={x:toBase.x-perpendicular.x*arrowHalfWidth,y:toBase.y-perpendicular.y*arrowHalfWidth};if(updateBounds({center:toArrowP2,width:0,height:0}),updateBounds({center:toArrowP3,width:0,height:0}),text){let midPoint2={x:(from.x+to3.x)/2+offsetVector.x,y:(from.y+to3.y)/2+offsetVector.y},textOffset=arrow_size*1.5,textPoint={x:midPoint2.x+perpendicular.x*textOffset,y:midPoint2.y+perpendicular.y*textOffset},textWidth=text.length*font_size*.6;updateBounds({center:textPoint,width:textWidth,height:font_size})}}else if(circuitJsonElm.type==="pcb_cutout"){let cutout=circuitJsonElm;if(cutout.shape==="rect")updateBounds({center:cutout.center,width:cutout.width,height:cutout.height});else if(cutout.shape==="circle"){let radius=distance.parse(cutout.radius);radius!==void 0&&updateBounds({center:cutout.center,width:radius*2,height:radius*2})}else if(cutout.shape==="polygon")updateTraceBounds(cutout.points);else if(cutout.shape==="path"){let cutoutPath=cutout;cutoutPath.route&&Array.isArray(cutoutPath.route)&&updateTraceBounds(cutoutPath.route)}}else if(circuitJsonElm.type==="pcb_keepout"){let keepout=circuitJsonElm;if(keepout.shape==="rect")updateBounds({center:keepout.center,width:keepout.width,height:keepout.height});else if(keepout.shape==="circle"){let radius=typeof keepout.radius=="number"?keepout.radius:distance.parse(keepout.radius)??0;radius>0&&updateBounds({center:keepout.center,width:radius*2,height:radius*2})}}else circuitJsonElm.type==="pcb_silkscreen_text"||circuitJsonElm.type==="pcb_silkscreen_rect"||circuitJsonElm.type==="pcb_silkscreen_circle"||circuitJsonElm.type==="pcb_silkscreen_line"||circuitJsonElm.type==="pcb_silkscreen_oval"?updateSilkscreenBounds(circuitJsonElm):circuitJsonElm.type==="pcb_copper_text"?updateBounds({center:circuitJsonElm.anchor_position,width:0,height:0}):circuitJsonElm.type==="pcb_copper_pour"&&(circuitJsonElm.shape==="rect"?updateBounds({center:circuitJsonElm.center,width:circuitJsonElm.width,height:circuitJsonElm.height}):circuitJsonElm.shape==="polygon"&&updateTraceBounds(circuitJsonElm.points));return{minX,minY,maxX,maxY,boardMinX,boardMinY,boardMaxX,boardMaxY,hasBounds:hasBounds2,hasBoardBounds};function updateBounds({center:center2,width,height}){if(!center2)return;let centerX=distance.parse(center2.x),centerY=distance.parse(center2.y);if(centerX===void 0||centerY===void 0)return;let numericWidth=distance.parse(width)??0,numericHeight=distance.parse(height)??0,halfWidth=numericWidth/2,halfHeight=numericHeight/2;minX=Math.min(minX,centerX-halfWidth),minY=Math.min(minY,centerY-halfHeight),maxX=Math.max(maxX,centerX+halfWidth),maxY=Math.max(maxY,centerY+halfHeight),hasBounds2=!0}function updateBoardBounds({center:center2,width,height}){if(!center2)return;let centerX=distance.parse(center2.x),centerY=distance.parse(center2.y);if(centerX===void 0||centerY===void 0)return;let numericWidth=distance.parse(width)??0,numericHeight=distance.parse(height)??0,halfWidth=numericWidth/2,halfHeight=numericHeight/2;boardMinX=Math.min(boardMinX,centerX-halfWidth),boardMinY=Math.min(boardMinY,centerY-halfHeight),boardMaxX=Math.max(boardMaxX,centerX+halfWidth),boardMaxY=Math.max(boardMaxY,centerY+halfHeight),hasBounds2=!0,hasBoardBounds=!0}function updateBoundsToIncludeOutline(outline){let updated=!1;for(let point7 of outline){let x4=distance.parse(point7.x),y4=distance.parse(point7.y);x4===void 0||y4===void 0||(minX=Math.min(minX,x4),minY=Math.min(minY,y4),maxX=Math.max(maxX,x4),maxY=Math.max(maxY,y4),updated=!0)}updated&&(hasBounds2=!0)}function updateBoardBoundsToIncludeOutline(outline){let updated=!1;for(let point7 of outline){let x4=distance.parse(point7.x),y4=distance.parse(point7.y);x4===void 0||y4===void 0||(boardMinX=Math.min(boardMinX,x4),boardMinY=Math.min(boardMinY,y4),boardMaxX=Math.max(boardMaxX,x4),boardMaxY=Math.max(boardMaxY,y4),updated=!0)}updated&&(hasBounds2=!0,hasBoardBounds=!0)}function updateTraceBounds(route){let updated=!1;for(let point7 of route){let x4=distance.parse(point7?.x),y4=distance.parse(point7?.y);x4===void 0||y4===void 0||(minX=Math.min(minX,x4),minY=Math.min(minY,y4),maxX=Math.max(maxX,x4),maxY=Math.max(maxY,y4),updated=!0)}updated&&(hasBounds2=!0)}function updateSilkscreenBounds(item){if(item.type==="pcb_silkscreen_text")updateBounds({center:item.anchor_position,width:0,height:0});else if(item.type==="pcb_silkscreen_path")updateTraceBounds(item.route);else if(item.type==="pcb_silkscreen_rect")updateBounds({center:item.center,width:item.width,height:item.height});else if(item.type==="pcb_silkscreen_circle"){let radius=distance.parse(item.radius);radius!==void 0&&updateBounds({center:item.center,width:radius*2,height:radius*2})}else if(item.type==="pcb_silkscreen_line")updateBounds({center:{x:item.x1,y:item.y1},width:0,height:0}),updateBounds({center:{x:item.x2,y:item.y2},width:0,height:0});else if(item.type==="pcb_silkscreen_oval"){let radiusX=distance.parse(item.radius_x),radiusY=distance.parse(item.radius_y);radiusX!==void 0&&radiusY!==void 0&&updateBounds({center:item.center,width:radiusX*2,height:radiusY*2})}else if(item.type==="pcb_cutout"){let cutout=item;if(cutout.shape==="rect")updateBounds({center:cutout.center,width:cutout.width,height:cutout.height});else if(cutout.shape==="circle"){let radius=distance.parse(cutout.radius);radius!==void 0&&updateBounds({center:cutout.center,width:radius*2,height:radius*2})}else if(cutout.shape==="polygon")updateTraceBounds(cutout.points);else if(cutout.shape==="path"){let cutoutPath=cutout;cutoutPath.route&&Array.isArray(cutoutPath.route)&&updateTraceBounds(cutoutPath.route)}}}}function rectBounds(center2,width,height){if(!center2||width===void 0||height===void 0)return;let cx3=distance.parse(center2.x),cy3=distance.parse(center2.y);if(cx3===void 0||cy3===void 0)return;let numericWidth=distance.parse(width),numericHeight=distance.parse(height);if(numericWidth===void 0||numericHeight===void 0)return;let halfW=numericWidth/2,halfH=numericHeight/2;return{minX:cx3-halfW,minY:cy3-halfH,maxX:cx3+halfW,maxY:cy3+halfH}}function getOutlineBounds(outline){if(!outline||outline.length<3)return;let minX=Number.POSITIVE_INFINITY,minY=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY;for(let pt3 of outline){let x4=distance.parse(pt3.x),y4=distance.parse(pt3.y);x4===void 0||y4===void 0||(minX=Math.min(minX,x4),minY=Math.min(minY,y4),maxX=Math.max(maxX,x4),maxY=Math.max(maxY,y4))}if(!(!Number.isFinite(minX)||!Number.isFinite(minY))&&!(!Number.isFinite(maxX)||!Number.isFinite(maxY)))return{minX,minY,maxX,maxY}}function convertCircuitJsonToPcbSvg(circuitJson,options){let drawPaddingOutsideBoard=options?.drawPaddingOutsideBoard??!0,layer=options?.layer,colorOverrides=options?.colorOverrides,copperColors={...DEFAULT_PCB_COLOR_MAP.copper};if(colorOverrides?.copper)for(let[layerName,color]of Object.entries(colorOverrides.copper))color!==void 0&&(copperColors[layerName]=color);let colorMap2={copper:copperColors,drill:colorOverrides?.drill??DEFAULT_PCB_COLOR_MAP.drill,silkscreen:{top:colorOverrides?.silkscreen?.top??DEFAULT_PCB_COLOR_MAP.silkscreen.top,bottom:colorOverrides?.silkscreen?.bottom??DEFAULT_PCB_COLOR_MAP.silkscreen.bottom},boardOutline:colorOverrides?.boardOutline??DEFAULT_PCB_COLOR_MAP.boardOutline,soldermask:{top:colorOverrides?.soldermask?.top??DEFAULT_PCB_COLOR_MAP.soldermask.top,bottom:colorOverrides?.soldermask?.bottom??DEFAULT_PCB_COLOR_MAP.soldermask.bottom},soldermaskOverCopper:{top:colorOverrides?.soldermaskOverCopper?.top??DEFAULT_PCB_COLOR_MAP.soldermaskOverCopper.top,bottom:colorOverrides?.soldermaskOverCopper?.bottom??DEFAULT_PCB_COLOR_MAP.soldermaskOverCopper.bottom},soldermaskWithCopperUnderneath:{top:colorOverrides?.soldermaskWithCopperUnderneath?.top??DEFAULT_PCB_COLOR_MAP.soldermaskWithCopperUnderneath.top,bottom:colorOverrides?.soldermaskWithCopperUnderneath?.bottom??DEFAULT_PCB_COLOR_MAP.soldermaskWithCopperUnderneath.bottom},substrate:colorOverrides?.substrate??DEFAULT_PCB_COLOR_MAP.substrate,courtyard:{top:colorOverrides?.courtyard?.top??DEFAULT_PCB_COLOR_MAP.courtyard.top,bottom:colorOverrides?.courtyard?.bottom??DEFAULT_PCB_COLOR_MAP.courtyard.bottom},keepout:colorOverrides?.keepout??DEFAULT_PCB_COLOR_MAP.keepout,debugComponent:{fill:colorOverrides?.debugComponent?.fill??DEFAULT_PCB_COLOR_MAP.debugComponent.fill,stroke:colorOverrides?.debugComponent?.stroke??DEFAULT_PCB_COLOR_MAP.debugComponent.stroke}},{minX,minY,maxX,maxY,boardMinX,boardMinY,boardMaxX,boardMaxY,hasBoardBounds}=getPcbBoundsFromCircuitJson(circuitJson),{boundsMinX,boundsMinY,boundsMaxX,boundsMaxY,padding}=getViewportBounds({circuitJson,drawPaddingOutsideBoard,baseBounds:{minX,minY,maxX,maxY,boardMinX,boardMinY,boardMaxX,boardMaxY,hasBoardBounds},viewportOptions:{viewport:options?.viewport,viewportTarget:options?.viewportTarget}}),circuitWidth=boundsMaxX-boundsMinX+2*padding,circuitHeight=boundsMaxY-boundsMinY+2*padding,svgWidth=options?.width??800,svgHeight=options?.height??600;if(options?.matchBoardAspectRatio){let viewportWidth=boundsMaxX-boundsMinX,viewportHeight=boundsMaxY-boundsMinY;if(viewportWidth>0&&viewportHeight>0){let aspect=viewportWidth/viewportHeight;options?.width&&!options?.height?svgHeight=options.width/aspect:options?.height&&!options?.width?svgWidth=options.height*aspect:svgHeight=svgWidth/aspect}}let paths=[];for(let circuitJsonElm of circuitJson)"route"in circuitJsonElm&&circuitJsonElm.route!==void 0&&paths.push(circuitJsonElm.route);let scaleX=svgWidth/circuitWidth,scaleY=svgHeight/circuitHeight,scaleFactor=Math.min(scaleX,scaleY),offsetX=(svgWidth-circuitWidth*scaleFactor)/2,offsetY=(svgHeight-circuitHeight*scaleFactor)/2,transform6=compose3(translate3(offsetX-boundsMinX*scaleFactor+padding*scaleFactor,svgHeight-offsetY+boundsMinY*scaleFactor-padding*scaleFactor),scale3(scaleFactor,-scaleFactor)),ctx={transform:transform6,layer,shouldDrawErrors:options?.shouldDrawErrors,showCourtyards:options?.showCourtyards,showPcbGroups:options?.showPcbGroups,drawPaddingOutsideBoard,colorMap:colorMap2,showSolderMask:options?.showSolderMask,showPcbNotes:options?.showPcbNotes??!0,showAnchorOffsets:options?.showAnchorOffsets,circuitJson},unsortedSvgObjects=circuitJson.flatMap(elm=>createSvgObjects({elm,circuitJson,ctx})),strokeWidth=String(.05*scaleFactor);for(let element of circuitJson)if("stroke_width"in element){strokeWidth=String(scaleFactor*element.stroke_width);break}if(options?.shouldDrawRatsNest){let ratsNestObjects=createSvgObjectsForRatsNest(circuitJson,ctx);unsortedSvgObjects=[...unsortedSvgObjects,...ratsNestObjects]}let svgObjects=sortSvgObjectsByPcbLayer(unsortedSvgObjects),children=[{name:"style",type:"element",value:"",attributes:{},children:[{type:"text",value:"",name:"",attributes:{},children:[]}]}],gridObjects=createSvgObjectsForPcbGrid({grid:options?.grid,svgWidth,svgHeight});if(gridObjects.defs&&children.push(gridObjects.defs),circuitJson.some(elm=>elm.type==="pcb_keepout")&&children.push(createKeepoutPatternDefs(colorMap2.keepout??DEFAULT_PCB_COLOR_MAP.keepout)),children.push({name:"rect",type:"element",value:"",attributes:{class:"boundary",x:"0",y:"0",fill:options?.backgroundColor??"#000",width:svgWidth.toString(),height:svgHeight.toString(),"data-type":"pcb_background","data-pcb-layer":"global"},children:[]}),drawPaddingOutsideBoard&&children.push(createSvgObjectFromPcbBoundary(transform6,minX,minY,maxX,maxY)),children.push(...svgObjects),gridObjects.rect&&children.push(gridObjects.rect),options?.showErrorsInTextOverlay){let errorOverlay=createErrorTextOverlay(circuitJson,"pcb_error_text_overlay");errorOverlay&&children.push(errorOverlay)}let softwareUsedString=getSoftwareUsedString(circuitJson),version2=CIRCUIT_TO_SVG_VERSION,svgObject={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:svgWidth.toString(),height:svgHeight.toString(),...softwareUsedString&&{"data-software-used-string":softwareUsedString},...options?.includeVersion&&{"data-circuit-to-svg-version":version2}},value:"",children:children.filter(child=>child!==null)};try{return(0,import_svgson2.stringify)(svgObject)}catch(error2){throw console.error("Error stringifying SVG object:",error2),error2}}function createSvgObjects({elm,circuitJson,ctx}){switch(elm.type){case"pcb_trace_error":return createSvgObjectsFromPcbTraceError(elm,circuitJson,ctx).filter(Boolean);case"pcb_footprint_overlap_error":return createSvgObjectsFromPcbFootprintOverlapError(elm,circuitJson,ctx).filter(Boolean);case"pcb_courtyard_overlap_error":return createSvgObjectsFromPcbCourtyardOverlapError(elm,circuitJson,ctx).filter(Boolean);case"pcb_component_outside_board_error":return createSvgObjectsFromPcbComponentOutsideBoardError(elm,circuitJson,ctx).filter(Boolean);case"pcb_via_trace_clearance_error":return createSvgObjectsFromPcbViaTraceClearanceError(elm,circuitJson,ctx).filter(Boolean);case"pcb_component":return createSvgObjectsFromPcbComponent(elm,ctx).filter(Boolean);case"pcb_trace":return createSvgObjectsFromPcbTrace(elm,ctx);case"pcb_copper_pour":return createSvgObjectsFromPcbCopperPour(elm,ctx);case"pcb_plated_hole":return createSvgObjectsFromPcbPlatedHole(elm,ctx).filter(Boolean);case"pcb_hole":return createSvgObjectsFromPcbHole(elm,ctx);case"pcb_smtpad":return createSvgObjectsFromSmtPad(elm,ctx);case"pcb_silkscreen_text":return createSvgObjectsFromPcbSilkscreenText(elm,ctx);case"pcb_silkscreen_rect":return createSvgObjectsFromPcbSilkscreenRect(elm,ctx);case"pcb_silkscreen_circle":return createSvgObjectsFromPcbSilkscreenCircle(elm,ctx);case"pcb_silkscreen_line":return createSvgObjectsFromPcbSilkscreenLine(elm,ctx);case"pcb_silkscreen_pill":return createSvgObjectsFromPcbSilkscreenPill(elm,ctx);case"pcb_silkscreen_oval":return createSvgObjectsFromPcbSilkscreenOval(elm,ctx);case"pcb_copper_text":return createSvgObjectsFromPcbCopperText(elm,ctx);case"pcb_courtyard_rect":return ctx.showCourtyards?createSvgObjectsFromPcbCourtyardRect(elm,ctx):[];case"pcb_courtyard_polygon":return ctx.showCourtyards?createSvgObjectsFromPcbCourtyardPolygon(elm,ctx):[];case"pcb_courtyard_circle":return ctx.showCourtyards?createSvgObjectsFromPcbCourtyardCircle(elm,ctx):[];case"pcb_courtyard_outline":return ctx.showCourtyards?createSvgObjectsFromPcbCourtyardOutline(elm,ctx):[];case"pcb_fabrication_note_path":return createSvgObjectsFromPcbFabricationNotePath(elm,ctx);case"pcb_fabrication_note_text":return createSvgObjectsFromPcbFabricationNoteText(elm,ctx);case"pcb_fabrication_note_rect":return createSvgObjectsFromPcbFabricationNoteRect(elm,ctx);case"pcb_fabrication_note_dimension":return createSvgObjectsFromPcbFabricationNoteDimension(elm,ctx);case"pcb_note_dimension":return ctx.showPcbNotes?createSvgObjectsFromPcbNoteDimension(elm,ctx):[];case"pcb_note_text":return ctx.showPcbNotes?createSvgObjectsFromPcbNoteText(elm,ctx):[];case"pcb_note_rect":return ctx.showPcbNotes?createSvgObjectsFromPcbNoteRect(elm,ctx):[];case"pcb_note_path":return ctx.showPcbNotes?createSvgObjectsFromPcbNotePath(elm,ctx):[];case"pcb_note_line":return ctx.showPcbNotes?createSvgObjectsFromPcbNoteLine(elm,ctx):[];case"pcb_silkscreen_path":return createSvgObjectsFromPcbSilkscreenPath(elm,ctx);case"pcb_panel":return ctx.drawPaddingOutsideBoard?createSvgObjectsFromPcbPanel(elm,ctx):[];case"pcb_board":return ctx.drawPaddingOutsideBoard?createSvgObjectsFromPcbBoard(elm,ctx):[];case"pcb_via":return createSvgObjectsFromPcbVia(elm,ctx);case"pcb_cutout":let cutout=elm;return cutout.shape==="path"?createSvgObjectsFromPcbCutoutPath(cutout,ctx):createSvgObjectsFromPcbCutout(elm,ctx);case"pcb_keepout":return createSvgObjectsFromPcbKeepout(elm,ctx);case"pcb_group":return ctx.showPcbGroups?createSvgObjectsFromPcbGroup(elm,ctx):[];default:return[]}}function createSvgObjectFromPcbBoundary(transform6,minX,minY,maxX,maxY){let[x12,y12]=applyToPoint3(transform6,[minX,minY]),[x22,y22]=applyToPoint3(transform6,[maxX,maxY]),width=Math.abs(x22-x12),height=Math.abs(y22-y12),x4=Math.min(x12,x22),y4=Math.min(y12,y22);return{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-boundary",fill:"none",stroke:"#fff","stroke-width":"0.3",x:x4.toString(),y:y4.toString(),width:width.toString(),height:height.toString(),"data-type":"pcb_boundary","data-pcb-layer":"global"}}}function createSvgObjectsFromAssemblyBoard(pcbBoard,transform6,style={}){let{width,height,center:center2,outline}=pcbBoard,path;if(outline&&Array.isArray(outline)&&outline.length>=3)path=outline.map((point7,index)=>{let[x4,y4]=applyToPoint3(transform6,[point7.x,point7.y]);return index===0?`M ${x4} ${y4}`:`L ${x4} ${y4}`}).join(" ");else{let halfWidth=width/2,halfHeight=height/2,topLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y-halfHeight]),topRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y-halfHeight]),bottomRight=applyToPoint3(transform6,[center2.x+halfWidth,center2.y+halfHeight]),bottomLeft=applyToPoint3(transform6,[center2.x-halfWidth,center2.y+halfHeight]);path=`M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]}`}return path+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:path,fill:style.fill??DEFAULT_BOARD_STYLE.fill,stroke:style.stroke??DEFAULT_BOARD_STYLE.stroke,"stroke-opacity":style.strokeOpacity??DEFAULT_BOARD_STYLE.strokeOpacity,"stroke-width":((style.strokeWidthFactor??DEFAULT_BOARD_STYLE.strokeWidthFactor)*Math.abs(transform6.a)).toString()}}]}function createSvgObjectsFromAssemblyComponent(params,ctx){let{elm,portPosition,name,arePinsInterchangeable}=params,{transform:transform6}=ctx,{center:center2,width,height,rotation:rotation5=0,layer="top"}=elm;if(!center2||typeof width!="number"||typeof height!="number")return null;let[x4,y4]=applyToPoint3(transform6,[center2.x,center2.y]),[pinX,pinY]=applyToPoint3(transform6,[portPosition.x,portPosition.y]),scaledWidth=width*Math.abs(transform6.a),scaledHeight=height*Math.abs(transform6.d),isTopLayer=layer==="top",isPinTop=pinY>y4,isPinLeft=pinX<x4,children=[createComponentPath(scaledWidth,scaledHeight,rotation5,layer),createComponentLabel(scaledWidth,scaledHeight,name??"",transform6)];return arePinsInterchangeable||children.push(createPin1Indicator(scaledWidth,scaledHeight,rotation5,layer,isPinTop,isPinLeft)),{name:"g",type:"element",value:"",attributes:{transform:`translate(${x4}, ${y4}) scale(1, -1)`},children}}function createComponentPath(scaledWidth,scaledHeight,rotation5,layer){let w4=scaledWidth/2,h6=scaledHeight/2;return{name:"path",type:"element",attributes:{class:"assembly-component",d:getRectPathData(w4,h6,rotation5),"stroke-width":.8.toFixed(2),transform:`rotate(${-rotation5})`,"stroke-dasharray":layer==="bottom"?"2,2":""},value:"",children:[]}}function createComponentLabel(scaledWidth,scaledHeight,name,transform6){let size3=Math.min(scaledWidth,scaledHeight),fontSize=Math.min(58,Math.max(3,size3*.8)),isTall=scaledHeight>scaledWidth;return{name:"text",type:"element",attributes:{x:"0",y:"0",class:"assembly-component-label","text-anchor":"middle",dy:".10em",style:"pointer-events: none","font-size":`${fontSize.toFixed(1)}px`,transform:isTall?"rotate(90) scale(1, -1)":"scale(1, -1)"},children:[{type:"text",value:name||"",name:"",attributes:{},children:[]}],value:""}}function createPin1Indicator(scaledWidth,scaledHeight,rotation5,layer,isPinTop,isPinLeft){let w4=scaledWidth/2,h6=scaledHeight/2,indicatorSize=Math.min(w4,h6)*.5,points;return isPinTop&&isPinLeft?points=[[-w4,-h6],[-w4+indicatorSize,-h6],[-w4,-h6+indicatorSize]]:isPinTop&&!isPinLeft?points=[[w4,-h6],[w4-indicatorSize,-h6],[w4,-h6+indicatorSize]]:!isPinTop&&isPinLeft?points=[[-w4,h6],[-w4+indicatorSize,h6],[-w4,h6-indicatorSize]]:points=[[w4,h6],[w4-indicatorSize,h6],[w4,h6-indicatorSize]],{name:"polygon",type:"element",attributes:{class:"assembly-pin1-indicator",points:points.map(p4=>p4.join(",")).join(" "),fill:"#333",stroke:"none",transform:`rotate(${-rotation5})`},value:"",children:[]}}function getRectPathData(w4,h6,rotation5){let rotatePoint6=(x4,y4,angle)=>{let rad=Math.PI/180*angle,cos6=Math.cos(rad),sin6=Math.sin(rad);return[x4*cos6-y4*sin6,x4*sin6+y4*cos6]};return`${[[-w4,-h6],[w4,-h6],[w4,h6],[-w4,h6]].map(([x4,y4])=>rotatePoint6(x4,y4,rotation5)).map(([x4,y4],i3)=>i3===0?`M${x4},${y4}`:`L${x4},${y4}`).join(" ")} Z`}function createSvgObjectsFromAssemblyHole(hole,ctx){let{transform:transform6}=ctx,[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]);if(hole.hole_shape==="circle"||hole.hole_shape==="square"){let scaledDiameter=hole.hole_diameter*Math.abs(transform6.a),radius=scaledDiameter/2;return hole.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"assembly-hole",cx:x4.toString(),cy:y4.toString(),r:radius.toString(),fill:HOLE_COLOR2},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"assembly-hole",x:(x4-radius).toString(),y:(y4-radius).toString(),width:scaledDiameter.toString(),height:scaledDiameter.toString(),fill:HOLE_COLOR2},children:[],value:""}]}if(hole.hole_shape==="oval"){let scaledWidth=hole.hole_width*Math.abs(transform6.a),scaledHeight=hole.hole_height*Math.abs(transform6.a),rx3=scaledWidth/2,ry3=scaledHeight/2;return[{name:"ellipse",type:"element",attributes:{class:"assembly-hole",cx:x4.toString(),cy:y4.toString(),rx:rx3.toString(),ry:ry3.toString(),fill:HOLE_COLOR2},children:[],value:""}]}return[]}function createSvgObjectsFromAssemblyPlatedHole(hole,ctx){let{transform:transform6}=ctx,[x4,y4]=applyToPoint3(transform6,[hole.x,hole.y]);if(hole.shape==="pill"){let scaledOuterWidth=hole.outer_width*Math.abs(transform6.a),scaledOuterHeight=hole.outer_height*Math.abs(transform6.a),scaledHoleWidth=hole.hole_width*Math.abs(transform6.a),scaledHoleHeight=hole.hole_height*Math.abs(transform6.a),outerRadiusX=scaledOuterWidth/2,straightLength=scaledOuterHeight-scaledOuterWidth,innerRadiusX=scaledHoleWidth/2;return[{name:"g",type:"element",children:[{name:"path",type:"element",attributes:{class:"assembly-hole-outer",fill:PAD_COLOR,d:`M${x4-outerRadiusX},${y4-straightLength/2} v${straightLength} a${outerRadiusX},${outerRadiusX} 0 0 0 ${scaledOuterWidth},0 v-${straightLength} a${outerRadiusX},${outerRadiusX} 0 0 0 -${scaledOuterWidth},0 z`},value:"",children:[]},{name:"path",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,d:`M${x4-innerRadiusX},${y4-(scaledHoleHeight-scaledHoleWidth)/2} v${scaledHoleHeight-scaledHoleWidth} a${innerRadiusX},${innerRadiusX} 0 0 0 ${scaledHoleWidth},0 v-${scaledHoleHeight-scaledHoleWidth} a${innerRadiusX},${innerRadiusX} 0 0 0 -${scaledHoleWidth},0 z`},value:"",children:[]}],value:"",attributes:{}}]}if(hole.shape==="circle"){let scaledOuterWidth=hole.outer_diameter*Math.abs(transform6.a),scaledOuterHeight=hole.outer_diameter*Math.abs(transform6.a),scaledHoleWidth=hole.hole_diameter*Math.abs(transform6.a),scaledHoleHeight=hole.hole_diameter*Math.abs(transform6.a),outerRadius=Math.min(scaledOuterWidth,scaledOuterHeight)/2,innerRadius=Math.min(scaledHoleWidth,scaledHoleHeight)/2;return[{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"assembly-hole-outer",fill:PAD_COLOR,cx:x4.toString(),cy:y4.toString(),r:outerRadius.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,cx:x4.toString(),cy:y4.toString(),r:innerRadius.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(hole.shape==="circular_hole_with_rect_pad"){let circularHole=hole,scaledHoleDiameter=circularHole.hole_diameter*Math.abs(transform6.a),scaledRectPadWidth=circularHole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=circularHole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(circularHole.rect_border_radius??0)*Math.abs(transform6.a),rectCcwRotation=circularHole.rect_ccw_rotation??0,holeRadius=scaledHoleDiameter/2,[holeCx,holeCy]=applyToPoint3(transform6,[circularHole.x+circularHole.hole_offset_x,circularHole.y+circularHole.hole_offset_y]);return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:PAD_COLOR,...rectCcwRotation?{x:(-scaledRectPadWidth/2).toString(),y:(-scaledRectPadHeight/2).toString(),transform:`translate(${x4} ${y4}) rotate(${-rectCcwRotation})`}:{x:(x4-scaledRectPadWidth/2).toString(),y:(y4-scaledRectPadHeight/2).toString()},width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{}},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,cx:holeCx.toString(),cy:holeCy.toString(),r:holeRadius.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(hole.shape==="pill_hole_with_rect_pad"){let pillHole=hole,scaledRectPadWidth=pillHole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=pillHole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(pillHole.rect_border_radius??0)*Math.abs(transform6.a),scaledHoleHeight=pillHole.hole_height*Math.abs(transform6.a),scaledHoleWidth=pillHole.hole_width*Math.abs(transform6.a),pillHoleWithOffsets=pillHole,holeOffsetX=pillHoleWithOffsets.hole_offset_x??0,holeOffsetY=pillHoleWithOffsets.hole_offset_y??0,[holeCenterX,holeCenterY]=applyToPoint3(transform6,[pillHole.x+holeOffsetX,pillHole.y+holeOffsetY]),holeRadius=Math.min(scaledHoleHeight,scaledHoleWidth)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:PAD_COLOR,x:(x4-scaledRectPadWidth/2).toString(),y:(y4-scaledRectPadHeight/2).toString(),width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{}},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,x:(holeCenterX-scaledHoleWidth/2).toString(),y:(holeCenterY-scaledHoleHeight/2).toString(),width:scaledHoleWidth.toString(),height:scaledHoleHeight.toString(),rx:holeRadius.toString(),ry:holeRadius.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(hole.shape==="rotated_pill_hole_with_rect_pad"){let rotatedHole=hole,scaledRectPadWidth=rotatedHole.rect_pad_width*Math.abs(transform6.a),scaledRectPadHeight=rotatedHole.rect_pad_height*Math.abs(transform6.a),scaledRectBorderRadius=(rotatedHole.rect_border_radius??0)*Math.abs(transform6.a),scaledHoleHeight=rotatedHole.hole_height*Math.abs(transform6.a),scaledHoleWidth=rotatedHole.hole_width*Math.abs(transform6.a),rotatedHoleWithOffsets=rotatedHole,holeOffsetX=rotatedHoleWithOffsets.hole_offset_x??0,holeOffsetY=rotatedHoleWithOffsets.hole_offset_y??0,[holeCenterX,holeCenterY]=applyToPoint3(transform6,[rotatedHole.x+holeOffsetX,rotatedHole.y+holeOffsetY]),holeRadius=Math.min(scaledHoleHeight,scaledHoleWidth)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:PAD_COLOR,x:(-scaledRectPadWidth/2).toString(),y:(-scaledRectPadHeight/2).toString(),width:scaledRectPadWidth.toString(),height:scaledRectPadHeight.toString(),transform:`translate(${x4} ${y4}) rotate(${-rotatedHole.rect_ccw_rotation})`,...scaledRectBorderRadius?{rx:scaledRectBorderRadius.toString(),ry:scaledRectBorderRadius.toString()}:{}},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"assembly-hole-inner",fill:HOLE_COLOR3,x:(-scaledHoleWidth/2).toString(),y:(-scaledHoleHeight/2).toString(),width:scaledHoleWidth.toString(),height:scaledHoleHeight.toString(),rx:holeRadius.toString(),ry:holeRadius.toString(),transform:`translate(${holeCenterX} ${holeCenterY}) rotate(${-rotatedHole.hole_ccw_rotation})`},value:"",children:[]}],value:"",attributes:{}}]}return[]}function createSvgObjectsFromAssemblySmtPad(pad2,ctx){let{transform:transform6}=ctx;if(pad2.shape==="rect"||pad2.shape==="rotated_rect"){let width=pad2.width*Math.abs(transform6.a),height=pad2.height*Math.abs(transform6.d),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]),scaledBorderRadius=(pad2.rect_border_radius??0)*Math.abs(transform6.a);return pad2.shape==="rotated_rect"&&pad2.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,x:(-width/2).toString(),y:(-height/2).toString(),width:width.toString(),height:height.toString(),transform:`translate(${x4} ${y4}) rotate(${-pad2.ccw_rotation})`,"data-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}},value:"",children:[]}]:[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),"data-layer":pad2.layer,...scaledBorderRadius?{rx:scaledBorderRadius.toString(),ry:scaledBorderRadius.toString()}:{}},value:"",children:[]}]}if(pad2.shape==="pill"){let width=pad2.width*Math.abs(transform6.a),height=pad2.height*Math.abs(transform6.d),radius=pad2.radius*Math.abs(transform6.a),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]);return[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,x:(x4-width/2).toString(),y:(y4-height/2).toString(),width:width.toString(),height:height.toString(),rx:radius.toString(),ry:radius.toString(),"data-layer":pad2.layer},value:"",children:[]}]}if(pad2.shape==="circle"){let radius=pad2.radius*Math.abs(transform6.a),[x4,y4]=applyToPoint3(transform6,[pad2.x,pad2.y]);return[{name:"circle",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,cx:x4.toString(),cy:y4.toString(),r:radius.toString(),"data-layer":pad2.layer},value:"",children:[]}]}if(pad2.shape==="polygon"){let points=(pad2.points??[]).map(point7=>applyToPoint3(transform6,[point7.x,point7.y]));return[{name:"polygon",type:"element",attributes:{class:"assembly-pad",fill:PAD_COLOR2,points:points.map(p4=>p4.join(",")).join(" "),"data-layer":pad2.layer},value:"",children:[]}]}return[]}function convertCircuitJsonToAssemblySvg(soup,options){let minX=Number.POSITIVE_INFINITY,minY=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY;for(let item of soup)if(item.type==="pcb_board"){let center2=item.center,width=item.width||0,height=item.height||0;minX=Math.min(minX,center2.x-width/2),minY=Math.min(minY,center2.y-height/2),maxX=Math.max(maxX,center2.x+width/2),maxY=Math.max(maxY,center2.y+height/2)}let padding=1,circuitWidth=maxX-minX+2*padding,circuitHeight=maxY-minY+2*padding,svgWidth=options?.width??800,svgHeight=options?.height??600,scaleX=svgWidth/circuitWidth,scaleY=svgHeight/circuitHeight,scaleFactor=Math.min(scaleX,scaleY),offsetX=(svgWidth-circuitWidth*scaleFactor)/2,offsetY=(svgHeight-circuitHeight*scaleFactor)/2,transform6=compose3(translate3(offsetX-minX*scaleFactor+padding*scaleFactor,svgHeight-offsetY+minY*scaleFactor-padding*scaleFactor),scale3(scaleFactor,-scaleFactor)),ctx={transform:transform6},svgObjects=soup.sort((a3,b3)=>(OBJECT_ORDER.indexOf(b3.type)??9999)-(OBJECT_ORDER.indexOf(a3.type)??9999)).flatMap(item=>createSvgObjects2(item,ctx,soup)),softwareUsedString=getSoftwareUsedString(soup),version2=CIRCUIT_TO_SVG_VERSION,children=[{name:"style",type:"element",children:[{type:"text",value:`
|
|
230
230
|
.assembly-component {
|
|
231
231
|
fill: none;
|
|
232
232
|
stroke: #000;
|
|
@@ -296,7 +296,8 @@ svg { font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; }
|
|
|
296
296
|
L ${screenOutlinePoints[3].x},${screenOutlinePoints[3].y}
|
|
297
297
|
L ${screenOutlinePoints[4].x},${screenOutlinePoints[4].y}
|
|
298
298
|
Z
|
|
299
|
-
`;svgObjects.push({name:"path",type:"element",attributes:{class:"net-label",d:pathD,fill:colorMap2.schematic.label_background,stroke:colorMap2.schematic.label_global,"stroke-width":`${getSchStrokeSize(realToScreenTransform)}px`},value:"",children:[]});let screenTextPos={x:screenAnchorPosition.x+screenTextGrowthVec.x*fontSizePx*.5,y:screenAnchorPosition.y+screenTextGrowthVec.y*fontSizePx*.5},textAnchor={left:"start",top:"start",bottom:"start",right:"end"}[schNetLabel.anchor_side],textTransformString={left:"",right:"",top:`rotate(90 ${screenTextPos.x} ${screenTextPos.y})`,bottom:`rotate(-90 ${screenTextPos.x} ${screenTextPos.y})`}[schNetLabel.anchor_side];return svgObjects.push({name:"text",type:"element",attributes:{class:"net-label-text",x:screenTextPos.x.toString(),y:screenTextPos.y.toString(),fill:colorMap2.schematic.label_global,"text-anchor":textAnchor,"dominant-baseline":"central","font-family":"sans-serif","font-variant-numeric":"tabular-nums","font-size":`${fontSizePx}px`,transform:textTransformString},children:[{type:"text",value:labelText||"",name:"",attributes:{},children:[]}],value:""}),svgObjects},createSvgObjectsFromSchematicBox=({schematicBox,transform:transform6,colorMap:colorMap2})=>{let topLeft=applyToPoint3(transform6,{x:schematicBox.x,y:schematicBox.y}),bottomRight=applyToPoint3(transform6,{x:schematicBox.x+schematicBox.width,y:schematicBox.y+schematicBox.height}),yTop=Math.min(topLeft.y,bottomRight.y),yBottom=Math.max(topLeft.y,bottomRight.y),xLeft=Math.min(topLeft.x,bottomRight.x),xRight=Math.max(topLeft.x,bottomRight.x),strokeWidthPx=getSchStrokeSize(transform6),attributes2={class:"schematic-box",x:xLeft.toString(),y:yTop.toString(),width:(xRight-xLeft).toString(),height:(yBottom-yTop).toString(),"stroke-width":`${strokeWidthPx}px`,stroke:colorMap2.schematic.component_outline||"black",fill:"transparent"};if(schematicBox.is_dashed){let dashLength=8*strokeWidthPx,gapLength=4*strokeWidthPx;attributes2["stroke-dasharray"]=`${dashLength} ${gapLength}`}return[{name:"rect",type:"element",value:"",attributes:attributes2,children:[]}]},createSvgObjectsFromSchematicTable=({schematicTable,transform:transform6,colorMap:colorMap2,circuitJson})=>{let{anchor_position,border_width=.05,anchor="center"}=schematicTable,{column_widths,row_heights}=getTableDimensions(schematicTable,circuitJson),totalWidth=column_widths.reduce((a3,b3)=>a3+b3,0),totalHeight=row_heights.reduce((a3,b3)=>a3+b3,0),topLeftX=anchor_position.x,topLeftY=anchor_position.y;anchor.includes("center")?topLeftX-=totalWidth/2:anchor.includes("right")&&(topLeftX-=totalWidth),anchor.includes("center")?topLeftY+=totalHeight/2:anchor.includes("bottom")&&(topLeftY+=totalHeight);let svgObjects=[],borderStrokeWidth=border_width*Math.abs(transform6.a),gridStrokeWidth=getSchStrokeSize(transform6),[screenTopLeftX,screenTopLeftY]=applyToPoint3(transform6,[topLeftX,topLeftY]),[screenBottomRightX,screenBottomRightY]=applyToPoint3(transform6,[topLeftX+totalWidth,topLeftY-totalHeight]);svgObjects.push({name:"rect",type:"element",attributes:{x:screenTopLeftX.toString(),y:screenTopLeftY.toString(),width:(screenBottomRightX-screenTopLeftX).toString(),height:(screenBottomRightY-screenTopLeftY).toString(),fill:"none",stroke:colorMap2.schematic.table,"stroke-width":borderStrokeWidth.toString()},children:[],value:""});let cells=circuitJson.filter(elm=>elm.type==="schematic_table_cell"&&elm.schematic_table_id===schematicTable.schematic_table_id),currentX=topLeftX;for(let i3=0;i3<column_widths.length-1;i3++){currentX+=column_widths[i3];let segmentStartY=topLeftY;for(let j4=0;j4<row_heights.length;j4++){let segmentEndY=segmentStartY-row_heights[j4];if(!cells.some(cell=>cell.start_column_index<=i3&&cell.end_column_index>i3&&cell.start_row_index<=j4&&cell.end_row_index>=j4)){let start=applyToPoint3(transform6,{x:currentX,y:segmentStartY}),end=applyToPoint3(transform6,{x:currentX,y:segmentEndY});svgObjects.push({name:"line",type:"element",attributes:{x1:start.x.toString(),y1:start.y.toString(),x2:end.x.toString(),y2:end.y.toString(),stroke:colorMap2.schematic.table,"stroke-width":gridStrokeWidth.toString()},children:[],value:""})}segmentStartY=segmentEndY}}let currentY=topLeftY;for(let i3=0;i3<row_heights.length-1;i3++){currentY-=row_heights[i3];let segmentStartX=topLeftX;for(let j4=0;j4<column_widths.length;j4++){let segmentEndX=segmentStartX+column_widths[j4];if(!cells.some(cell=>cell.start_row_index<=i3&&cell.end_row_index>i3&&cell.start_column_index<=j4&&cell.end_column_index>=j4)){let start=applyToPoint3(transform6,{x:segmentStartX,y:currentY}),end=applyToPoint3(transform6,{x:segmentEndX,y:currentY});svgObjects.push({name:"line",type:"element",attributes:{x1:start.x.toString(),y1:start.y.toString(),x2:end.x.toString(),y2:end.y.toString(),stroke:colorMap2.schematic.table,"stroke-width":gridStrokeWidth.toString()},children:[],value:""})}segmentStartX=segmentEndX}}for(let cell of cells)if(cell.text){let cellWidth=column_widths.slice(cell.start_column_index,cell.end_column_index+1).reduce((a3,b3)=>a3+b3,0),cellHeight=row_heights.slice(cell.start_row_index,cell.end_row_index+1).reduce((a3,b3)=>a3+b3,0),cellTopLeftX=topLeftX+column_widths.slice(0,cell.start_column_index).reduce((a3,b3)=>a3+b3,0),cellTopLeftY=topLeftY-row_heights.slice(0,cell.start_row_index).reduce((a3,b3)=>a3+b3,0),{cell_padding=.2}=schematicTable,horizontal_align=cell.horizontal_align??"center",vertical_align=cell.vertical_align??"middle",realTextAnchorPos={x:cellTopLeftX+cellWidth/2,y:cellTopLeftY-cellHeight/2};horizontal_align==="left"?realTextAnchorPos.x=cellTopLeftX+cell_padding:horizontal_align==="right"&&(realTextAnchorPos.x=cellTopLeftX+cellWidth-cell_padding),vertical_align==="top"?realTextAnchorPos.y=cellTopLeftY-cell_padding:vertical_align==="bottom"&&(realTextAnchorPos.y=cellTopLeftY-cellHeight+cell_padding);let screenTextAnchorPos=applyToPoint3(transform6,realTextAnchorPos),fontSize=getSchScreenFontSize(transform6,"reference_designator",cell.font_size),textAnchorMap={left:"start",center:"middle",right:"end"},dominantBaselineMap={top:"hanging",middle:"middle",bottom:"ideographic"};svgObjects.push({name:"text",type:"element",attributes:{x:screenTextAnchorPos.x.toString(),y:screenTextAnchorPos.y.toString(),"font-size":`${fontSize}px`,"text-anchor":textAnchorMap[horizontal_align],"dominant-baseline":dominantBaselineMap[vertical_align],fill:colorMap2.schematic.table,"font-family":"sans-serif"},children:[{type:"text",value:cell.text,name:"",attributes:{},children:[]}],value:""})}return[{name:"g",type:"element",attributes:{"data-schematic-table-id":schematicTable.schematic_table_id},children:svgObjects,value:""}]},PIN_CIRCLE_RADIUS_MM2=.02,createSvgObjectsForSchPortHover=({schPort,transform:transform6})=>{let screenSchPortPos=applyToPoint3(transform6,schPort.center),pinRadiusPx=Math.abs(transform6.a)*PIN_CIRCLE_RADIUS_MM2*2;return[{name:"g",type:"element",value:"",attributes:{class:"schematic-port-hover","data-schematic-port-id":schPort.source_port_id},children:[{name:"circle",type:"element",value:"",attributes:{cx:screenSchPortPos.x.toString(),cy:screenSchPortPos.y.toString(),r:pinRadiusPx.toString(),fill:"red",opacity:"0"},children:[]}]}]},createSvgObjectsForSchComponentPortHovers=({component,transform:transform6,circuitJson})=>{let schematicPorts=su2(circuitJson).schematic_port.list({schematic_component_id:component.schematic_component_id}),svgs=[];for(let schPort of schematicPorts)svgs.push(...createSvgObjectsForSchPortHover({schPort,transform:transform6}));return svgs},PIN_CIRCLE_RADIUS_MM3=.02,createSvgObjectsForSchPortIndicator=({schPort,transform:transform6,circuitJson,colorMap:colorMap2})=>{let svgObjects=[],radiusPx=Math.abs(transform6.a)*PIN_CIRCLE_RADIUS_MM3,strokeWidth=Math.abs(transform6.a)*PIN_CIRCLE_RADIUS_MM3,screenPos=applyToPoint3(transform6,schPort.center);svgObjects.push({name:"circle",type:"element",value:"",attributes:{class:"component-pin",cx:screenPos.x.toString(),cy:screenPos.y.toString(),r:radiusPx.toString(),fill:"none",stroke:colorMap2.schematic.component_outline,"stroke-width":strokeWidth.toString(),"data-schematic-port-id":schPort.schematic_port_id},children:[]});let sourcePort=circuitJson.find(e5=>e5.type==="source_port"&&e5.source_port_id===schPort.source_port_id),label=schPort.display_pin_label??sourcePort?.name;if(label){let labelPos={...schPort.center},distanceFromComponentEdge=schPort.distance_from_component_edge??0,labelOffset=.05,textAnchor="middle",rotation5="";switch(schPort.facing_direction){case"left":labelPos.x+=distanceFromComponentEdge/2,labelPos.y+=labelOffset,textAnchor="start";break;case"right":labelPos.x-=distanceFromComponentEdge/2,labelPos.y+=labelOffset,textAnchor="end";break;case"up":labelPos.y-=distanceFromComponentEdge/2,labelPos.x-=labelOffset,textAnchor="middle";break;case"down":labelPos.y+=distanceFromComponentEdge/2,labelPos.x-=labelOffset,textAnchor="middle";break}let screenLabelPos=applyToPoint3(transform6,labelPos),fontSizePx=getSchScreenFontSize(transform6,"pin_number");(schPort.facing_direction==="up"||schPort.facing_direction==="down")&&(rotation5=`rotate(-90 ${screenLabelPos.x} ${screenLabelPos.y})`),svgObjects.push({name:"text",type:"element",value:"",attributes:{class:"port-indicator-label",x:screenLabelPos.x.toString(),y:screenLabelPos.y.toString(),fill:colorMap2.schematic.component_outline,"font-family":"sans-serif","font-size":`${fontSizePx*.7}px`,"text-anchor":textAnchor,"dominant-baseline":"middle",...rotation5&&{transform:rotation5}},children:[{type:"text",value:label,name:"",attributes:{},children:[]}]})}return svgObjects};circuitJsonToSchematicSvg=convertCircuitJsonToSchematicSvg;DEFAULT_WIDTH=1200,DEFAULT_HEIGHT=600,MARGIN={top:64,right:100,bottom:80,left:100},FALLBACK_LINE_COLOR="#1f77b4";MAX_LEGEND_LINE_LENGTH=15,LEGEND_LINE_HEIGHT=16,LEGEND_MIN_SPACING=24;DEFAULT_WIDTH2=1200,DEFAULT_HEIGHT2=1200,DEFAULT_SCHEMATIC_RATIO=.55;OBJECT_ORDER3=["pcb_board","pcb_solder_paste"]}});var require_s_expression=__commonJS({"node_modules/s-expression/index.js"(exports,module){"use strict";function SParser(stream){this._line=this._col=this._pos=0,this._stream=stream}SParser.not_whitespace_or_end=/^(\S|$)/;SParser.space_quote_paren_escaped_or_end=/^(\s|\\|"|'|`|,|\(|\)|$)/;SParser.string_or_escaped_or_end=/^(\\|"|$)/;SParser.string_delimiters=/["]/;SParser.quotes=/['`,]/;SParser.quotes_map={"'":"quote","`":"quasiquote",",":"unquote"};SParser.prototype={peek,consume,until,error:error2,string,atom,quoted,expr,list};module.exports=function SParse(stream){var parser=new SParse.Parser(stream),expression=parser.expr();return expression instanceof Error?expression:parser.peek()!=""?parser.error("Superfluous characters after expression: `"+parser.peek()+"`"):expression};module.exports.Parser=SParser;module.exports.SyntaxError=Error;function error2(msg){var e5=new Error("Syntax error: "+msg);return e5.line=this._line+1,e5.col=this._col+1,e5}function peek(){return this._stream.length==this._pos?"":this._stream[this._pos]}function consume(){if(this._stream.length==this._pos)return"";var c4=this._stream[this._pos];return this._pos+=1,c4=="\r"?(this.peek()==`
|
|
299
|
+
`;svgObjects.push({name:"path",type:"element",attributes:{class:"net-label",d:pathD,fill:colorMap2.schematic.label_background,stroke:colorMap2.schematic.label_global,"stroke-width":`${getSchStrokeSize(realToScreenTransform)}px`},value:"",children:[]});let screenTextPos={x:screenAnchorPosition.x+screenTextGrowthVec.x*fontSizePx*.5,y:screenAnchorPosition.y+screenTextGrowthVec.y*fontSizePx*.5},textAnchor={left:"start",top:"start",bottom:"start",right:"end"}[schNetLabel.anchor_side],textTransformString={left:"",right:"",top:`rotate(90 ${screenTextPos.x} ${screenTextPos.y})`,bottom:`rotate(-90 ${screenTextPos.x} ${screenTextPos.y})`}[schNetLabel.anchor_side];return svgObjects.push({name:"text",type:"element",attributes:{class:"net-label-text",x:screenTextPos.x.toString(),y:screenTextPos.y.toString(),fill:colorMap2.schematic.label_global,"text-anchor":textAnchor,"dominant-baseline":"central","font-family":"sans-serif","font-variant-numeric":"tabular-nums","font-size":`${fontSizePx}px`,transform:textTransformString},children:[{type:"text",value:labelText||"",name:"",attributes:{},children:[]}],value:""}),svgObjects},createSvgObjectsFromSchematicBox=({schematicBox,transform:transform6,colorMap:colorMap2})=>{let topLeft=applyToPoint3(transform6,{x:schematicBox.x,y:schematicBox.y}),bottomRight=applyToPoint3(transform6,{x:schematicBox.x+schematicBox.width,y:schematicBox.y+schematicBox.height}),yTop=Math.min(topLeft.y,bottomRight.y),yBottom=Math.max(topLeft.y,bottomRight.y),xLeft=Math.min(topLeft.x,bottomRight.x),xRight=Math.max(topLeft.x,bottomRight.x),strokeWidthPx=getSchStrokeSize(transform6),attributes2={class:"schematic-box",x:xLeft.toString(),y:yTop.toString(),width:(xRight-xLeft).toString(),height:(yBottom-yTop).toString(),"stroke-width":`${strokeWidthPx}px`,stroke:colorMap2.schematic.component_outline||"black",fill:"transparent"};if(schematicBox.is_dashed){let dashLength=8*strokeWidthPx,gapLength=4*strokeWidthPx;attributes2["stroke-dasharray"]=`${dashLength} ${gapLength}`}return[{name:"rect",type:"element",value:"",attributes:attributes2,children:[]}]},createSvgObjectsFromSchematicTable=({schematicTable,transform:transform6,colorMap:colorMap2,circuitJson})=>{let{anchor_position,border_width=.05,anchor="center"}=schematicTable,{column_widths,row_heights}=getTableDimensions(schematicTable,circuitJson),totalWidth=column_widths.reduce((a3,b3)=>a3+b3,0),totalHeight=row_heights.reduce((a3,b3)=>a3+b3,0),topLeftX=anchor_position.x,topLeftY=anchor_position.y;anchor.includes("center")?topLeftX-=totalWidth/2:anchor.includes("right")&&(topLeftX-=totalWidth),anchor.includes("center")?topLeftY+=totalHeight/2:anchor.includes("bottom")&&(topLeftY+=totalHeight);let svgObjects=[],borderStrokeWidth=border_width*Math.abs(transform6.a),gridStrokeWidth=getSchStrokeSize(transform6),[screenTopLeftX,screenTopLeftY]=applyToPoint3(transform6,[topLeftX,topLeftY]),[screenBottomRightX,screenBottomRightY]=applyToPoint3(transform6,[topLeftX+totalWidth,topLeftY-totalHeight]);svgObjects.push({name:"rect",type:"element",attributes:{x:screenTopLeftX.toString(),y:screenTopLeftY.toString(),width:(screenBottomRightX-screenTopLeftX).toString(),height:(screenBottomRightY-screenTopLeftY).toString(),fill:"none",stroke:colorMap2.schematic.table,"stroke-width":borderStrokeWidth.toString()},children:[],value:""});let cells=circuitJson.filter(elm=>elm.type==="schematic_table_cell"&&elm.schematic_table_id===schematicTable.schematic_table_id),currentX=topLeftX;for(let i3=0;i3<column_widths.length-1;i3++){currentX+=column_widths[i3];let segmentStartY=topLeftY;for(let j4=0;j4<row_heights.length;j4++){let segmentEndY=segmentStartY-row_heights[j4];if(!cells.some(cell=>cell.start_column_index<=i3&&cell.end_column_index>i3&&cell.start_row_index<=j4&&cell.end_row_index>=j4)){let start=applyToPoint3(transform6,{x:currentX,y:segmentStartY}),end=applyToPoint3(transform6,{x:currentX,y:segmentEndY});svgObjects.push({name:"line",type:"element",attributes:{x1:start.x.toString(),y1:start.y.toString(),x2:end.x.toString(),y2:end.y.toString(),stroke:colorMap2.schematic.table,"stroke-width":gridStrokeWidth.toString()},children:[],value:""})}segmentStartY=segmentEndY}}let currentY=topLeftY;for(let i3=0;i3<row_heights.length-1;i3++){currentY-=row_heights[i3];let segmentStartX=topLeftX;for(let j4=0;j4<column_widths.length;j4++){let segmentEndX=segmentStartX+column_widths[j4];if(!cells.some(cell=>cell.start_row_index<=i3&&cell.end_row_index>i3&&cell.start_column_index<=j4&&cell.end_column_index>=j4)){let start=applyToPoint3(transform6,{x:segmentStartX,y:currentY}),end=applyToPoint3(transform6,{x:segmentEndX,y:currentY});svgObjects.push({name:"line",type:"element",attributes:{x1:start.x.toString(),y1:start.y.toString(),x2:end.x.toString(),y2:end.y.toString(),stroke:colorMap2.schematic.table,"stroke-width":gridStrokeWidth.toString()},children:[],value:""})}segmentStartX=segmentEndX}}for(let cell of cells)if(cell.text){let cellWidth=column_widths.slice(cell.start_column_index,cell.end_column_index+1).reduce((a3,b3)=>a3+b3,0),cellHeight=row_heights.slice(cell.start_row_index,cell.end_row_index+1).reduce((a3,b3)=>a3+b3,0),cellTopLeftX=topLeftX+column_widths.slice(0,cell.start_column_index).reduce((a3,b3)=>a3+b3,0),cellTopLeftY=topLeftY-row_heights.slice(0,cell.start_row_index).reduce((a3,b3)=>a3+b3,0),{cell_padding=.2}=schematicTable,horizontal_align=cell.horizontal_align??"center",vertical_align=cell.vertical_align??"middle",realTextAnchorPos={x:cellTopLeftX+cellWidth/2,y:cellTopLeftY-cellHeight/2};horizontal_align==="left"?realTextAnchorPos.x=cellTopLeftX+cell_padding:horizontal_align==="right"&&(realTextAnchorPos.x=cellTopLeftX+cellWidth-cell_padding),vertical_align==="top"?realTextAnchorPos.y=cellTopLeftY-cell_padding:vertical_align==="bottom"&&(realTextAnchorPos.y=cellTopLeftY-cellHeight+cell_padding);let screenTextAnchorPos=applyToPoint3(transform6,realTextAnchorPos),fontSize=getSchScreenFontSize(transform6,"reference_designator",cell.font_size),textAnchorMap={left:"start",center:"middle",right:"end"},dominantBaselineMap={top:"hanging",middle:"middle",bottom:"ideographic"};svgObjects.push({name:"text",type:"element",attributes:{x:screenTextAnchorPos.x.toString(),y:screenTextAnchorPos.y.toString(),"font-size":`${fontSize}px`,"text-anchor":textAnchorMap[horizontal_align],"dominant-baseline":dominantBaselineMap[vertical_align],fill:colorMap2.schematic.table,"font-family":"sans-serif"},children:[{type:"text",value:cell.text,name:"",attributes:{},children:[]}],value:""})}return[{name:"g",type:"element",attributes:{"data-schematic-table-id":schematicTable.schematic_table_id},children:svgObjects,value:""}]},PIN_CIRCLE_RADIUS_MM2=.02,createSvgObjectsForSchPortHover=({schPort,transform:transform6})=>{let screenSchPortPos=applyToPoint3(transform6,schPort.center),pinRadiusPx=Math.abs(transform6.a)*PIN_CIRCLE_RADIUS_MM2*2;return[{name:"g",type:"element",value:"",attributes:{class:"schematic-port-hover","data-schematic-port-id":schPort.source_port_id},children:[{name:"circle",type:"element",value:"",attributes:{cx:screenSchPortPos.x.toString(),cy:screenSchPortPos.y.toString(),r:pinRadiusPx.toString(),fill:"red",opacity:"0"},children:[]}]}]},createSvgObjectsForSchComponentPortHovers=({component,transform:transform6,circuitJson})=>{let schematicPorts=su2(circuitJson).schematic_port.list({schematic_component_id:component.schematic_component_id}),svgs=[];for(let schPort of schematicPorts)svgs.push(...createSvgObjectsForSchPortHover({schPort,transform:transform6}));return svgs},PIN_CIRCLE_RADIUS_MM3=.02,createSvgObjectsForSchPortIndicator=({schPort,transform:transform6,circuitJson,colorMap:colorMap2})=>{let svgObjects=[],radiusPx=Math.abs(transform6.a)*PIN_CIRCLE_RADIUS_MM3,strokeWidth=Math.abs(transform6.a)*PIN_CIRCLE_RADIUS_MM3,screenPos=applyToPoint3(transform6,schPort.center);svgObjects.push({name:"circle",type:"element",value:"",attributes:{class:"component-pin",cx:screenPos.x.toString(),cy:screenPos.y.toString(),r:radiusPx.toString(),fill:"none",stroke:colorMap2.schematic.component_outline,"stroke-width":strokeWidth.toString(),"data-schematic-port-id":schPort.schematic_port_id},children:[]});let sourcePort=circuitJson.find(e5=>e5.type==="source_port"&&e5.source_port_id===schPort.source_port_id),label=schPort.display_pin_label??sourcePort?.name;if(label){let labelPos={...schPort.center},distanceFromComponentEdge=schPort.distance_from_component_edge??0,labelOffset=.05,textAnchor="middle",rotation5="";switch(schPort.facing_direction){case"left":labelPos.x+=distanceFromComponentEdge/2,labelPos.y+=labelOffset,textAnchor="start";break;case"right":labelPos.x-=distanceFromComponentEdge/2,labelPos.y+=labelOffset,textAnchor="end";break;case"up":labelPos.y-=distanceFromComponentEdge/2,labelPos.x-=labelOffset,textAnchor="middle";break;case"down":labelPos.y+=distanceFromComponentEdge/2,labelPos.x-=labelOffset,textAnchor="middle";break}let screenLabelPos=applyToPoint3(transform6,labelPos),fontSizePx=getSchScreenFontSize(transform6,"pin_number");(schPort.facing_direction==="up"||schPort.facing_direction==="down")&&(rotation5=`rotate(-90 ${screenLabelPos.x} ${screenLabelPos.y})`),svgObjects.push({name:"text",type:"element",value:"",attributes:{class:"port-indicator-label",x:screenLabelPos.x.toString(),y:screenLabelPos.y.toString(),fill:colorMap2.schematic.component_outline,"font-family":"sans-serif","font-size":`${fontSizePx*.7}px`,"text-anchor":textAnchor,"dominant-baseline":"middle",...rotation5&&{transform:rotation5}},children:[{type:"text",value:label,name:"",attributes:{},children:[]}]})}return svgObjects};circuitJsonToSchematicSvg=convertCircuitJsonToSchematicSvg;DEFAULT_WIDTH=1200,DEFAULT_HEIGHT=600,MARGIN={top:64,right:100,bottom:80,left:100},FALLBACK_LINE_COLOR="#1f77b4";MAX_LEGEND_LINE_LENGTH=15,LEGEND_LINE_HEIGHT=16,LEGEND_MIN_SPACING=24;DEFAULT_WIDTH2=1200,DEFAULT_HEIGHT2=1200,DEFAULT_SCHEMATIC_RATIO=.55;OBJECT_ORDER3=["pcb_board","pcb_solder_paste"]}});var require_grid_router=__commonJS({"node_modules/@tscircuit/krt-wasm/pkg-node/grid_router.js"(exports){"use strict";function routeSimpleRouteJson2(input2,options){let ret=wasm.routeSimpleRouteJson(input2,options);if(ret[2])throw takeFromExternrefTable0(ret[1]);return takeFromExternrefTable0(ret[0])}exports.routeSimpleRouteJson=routeSimpleRouteJson2;function __wbg_get_imports(){return{__proto__:null,"./grid_router_bg.js":{__proto__:null,__wbg_Error_3639a60ed15f87e7:function(arg0,arg1){return Error(getStringFromWasm0(arg0,arg1))},__wbg_Number_a3d737fd183f7dca:function(arg0){return Number(arg0)},__wbg_String_8564e559799eccda:function(arg0,arg1){let ret=String(arg1),ptr1=passStringToWasm0(ret,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),len1=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(arg0+4,len1,!0),getDataViewMemory0().setInt32(arg0+0,ptr1,!0)},__wbg___wbindgen_bigint_get_as_i64_3af6d4ca77193a4b:function(arg0,arg1){let v4=arg1,ret=typeof v4=="bigint"?v4:void 0;getDataViewMemory0().setBigInt64(arg0+8,isLikeNone(ret)?BigInt(0):ret,!0),getDataViewMemory0().setInt32(arg0+0,!isLikeNone(ret),!0)},__wbg___wbindgen_boolean_get_c3dd5c39f1b5a12b:function(arg0){let v4=arg0,ret=typeof v4=="boolean"?v4:void 0;return isLikeNone(ret)?16777215:ret?1:0},__wbg___wbindgen_debug_string_07cb72cfcc952e2b:function(arg0,arg1){let ret=debugString(arg1),ptr1=passStringToWasm0(ret,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),len1=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(arg0+4,len1,!0),getDataViewMemory0().setInt32(arg0+0,ptr1,!0)},__wbg___wbindgen_in_2617fa76397620d3:function(arg0,arg1){return arg0 in arg1},__wbg___wbindgen_is_bigint_d6a8167cac401b95:function(arg0){return typeof arg0=="bigint"},__wbg___wbindgen_is_function_2f0fd7ceb86e64c5:function(arg0){return typeof arg0=="function"},__wbg___wbindgen_is_null_066086be3abe9bb3:function(arg0){return arg0===null},__wbg___wbindgen_is_object_5b22ff2418063a9c:function(arg0){let val=arg0;return typeof val=="object"&&val!==null},__wbg___wbindgen_is_undefined_244a92c34d3b6ec0:function(arg0){return arg0===void 0},__wbg___wbindgen_jsval_eq_403eaa3610500a25:function(arg0,arg1){return arg0===arg1},__wbg___wbindgen_jsval_loose_eq_1978f1e77b4bce62:function(arg0,arg1){return arg0==arg1},__wbg___wbindgen_number_get_dd6d69a6079f26f1:function(arg0,arg1){let obj=arg1,ret=typeof obj=="number"?obj:void 0;getDataViewMemory0().setFloat64(arg0+8,isLikeNone(ret)?0:ret,!0),getDataViewMemory0().setInt32(arg0+0,!isLikeNone(ret),!0)},__wbg___wbindgen_string_get_965592073e5d848c:function(arg0,arg1){let obj=arg1,ret=typeof obj=="string"?obj:void 0;var ptr1=isLikeNone(ret)?0:passStringToWasm0(ret,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),len1=WASM_VECTOR_LEN;getDataViewMemory0().setInt32(arg0+4,len1,!0),getDataViewMemory0().setInt32(arg0+0,ptr1,!0)},__wbg___wbindgen_throw_9c75d47bf9e7731e:function(arg0,arg1){throw new Error(getStringFromWasm0(arg0,arg1))},__wbg_call_add9e5a76382e668:function(){return handleError(function(arg0,arg1){return arg0.call(arg1)},arguments)},__wbg_done_b1afd6201ac045e0:function(arg0){return arg0.done},__wbg_entries_bb9843ba73dc70d6:function(arg0){return Object.entries(arg0)},__wbg_get_652f640b3b0b6e3e:function(arg0,arg1){return arg0[arg1>>>0]},__wbg_get_9cfea9b7bbf12a15:function(){return handleError(function(arg0,arg1){return Reflect.get(arg0,arg1)},arguments)},__wbg_get_unchecked_be562b1421656321:function(arg0,arg1){return arg0[arg1>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(arg0,arg1){return arg0[arg1]},__wbg_instanceof_ArrayBuffer_eab9f28fbec23477:function(arg0){let result;try{result=arg0 instanceof ArrayBuffer}catch{result=!1}return result},__wbg_instanceof_Map_10d4edf60fcf9327:function(arg0){let result;try{result=arg0 instanceof Map}catch{result=!1}return result},__wbg_instanceof_Uint8Array_57d77acd50e4c44d:function(arg0){let result;try{result=arg0 instanceof Uint8Array}catch{result=!1}return result},__wbg_isArray_c6c6ef8308995bcf:function(arg0){return Array.isArray(arg0)},__wbg_isSafeInteger_3c56c421a5b4cce4:function(arg0){return Number.isSafeInteger(arg0)},__wbg_iterator_9d68985a1d096fc2:function(){return Symbol.iterator},__wbg_length_0a6ce016dc1460b0:function(arg0){return arg0.length},__wbg_length_ba3c032602efe310:function(arg0){return arg0.length},__wbg_new_2fad8ca02fd00684:function(){return new Object},__wbg_new_3baa8d9866155c79:function(){return new Array},__wbg_new_8454eee672b2ba6e:function(arg0){return new Uint8Array(arg0)},__wbg_next_261c3c48c6e309a5:function(arg0){return arg0.next},__wbg_next_aacee310bcfe6461:function(){return handleError(function(arg0){return arg0.next()},arguments)},__wbg_prototypesetcall_fd4050e806e1d519:function(arg0,arg1,arg2){Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0,arg1),arg2)},__wbg_set_6be42768c690e380:function(arg0,arg1,arg2){arg0[arg1]=arg2},__wbg_set_f614f6a0608d1d1d:function(arg0,arg1,arg2){arg0[arg1>>>0]=arg2},__wbg_value_f852716acdeb3e82:function(arg0){return arg0.value},__wbindgen_cast_0000000000000001:function(arg0){return arg0},__wbindgen_cast_0000000000000002:function(arg0){return arg0},__wbindgen_cast_0000000000000003:function(arg0,arg1){return getStringFromWasm0(arg0,arg1)},__wbindgen_cast_0000000000000004:function(arg0){return BigInt.asUintN(64,arg0)},__wbindgen_init_externref_table:function(){let table=wasm.__wbindgen_externrefs,offset=table.grow(4);table.set(0,void 0),table.set(offset+0,void 0),table.set(offset+1,null),table.set(offset+2,!0),table.set(offset+3,!1)}}}}function addToExternrefTable0(obj){let idx=wasm.__externref_table_alloc();return wasm.__wbindgen_externrefs.set(idx,obj),idx}function debugString(val){let type=typeof val;if(type=="number"||type=="boolean"||val==null)return`${val}`;if(type=="string")return`"${val}"`;if(type=="symbol"){let description=val.description;return description==null?"Symbol":`Symbol(${description})`}if(type=="function"){let name=val.name;return typeof name=="string"&&name.length>0?`Function(${name})`:"Function"}if(Array.isArray(val)){let length4=val.length,debug18="[";length4>0&&(debug18+=debugString(val[0]));for(let i3=1;i3<length4;i3++)debug18+=", "+debugString(val[i3]);return debug18+="]",debug18}let builtInMatches=/\[object ([^\]]+)\]/.exec(toString.call(val)),className;if(builtInMatches&&builtInMatches.length>1)className=builtInMatches[1];else return toString.call(val);if(className=="Object")try{return"Object("+JSON.stringify(val)+")"}catch{return"Object"}return val instanceof Error?`${val.name}: ${val.message}
|
|
300
|
+
${val.stack}`:className}function getArrayU8FromWasm0(ptr,len){return ptr=ptr>>>0,getUint8ArrayMemory0().subarray(ptr/1,ptr/1+len)}var cachedDataViewMemory0=null;function getDataViewMemory0(){return(cachedDataViewMemory0===null||cachedDataViewMemory0.buffer.detached===!0||cachedDataViewMemory0.buffer.detached===void 0&&cachedDataViewMemory0.buffer!==wasm.memory.buffer)&&(cachedDataViewMemory0=new DataView(wasm.memory.buffer)),cachedDataViewMemory0}function getStringFromWasm0(ptr,len){return decodeText(ptr>>>0,len)}var cachedUint8ArrayMemory0=null;function getUint8ArrayMemory0(){return(cachedUint8ArrayMemory0===null||cachedUint8ArrayMemory0.byteLength===0)&&(cachedUint8ArrayMemory0=new Uint8Array(wasm.memory.buffer)),cachedUint8ArrayMemory0}function handleError(f3,args){try{return f3.apply(this,args)}catch(e5){let idx=addToExternrefTable0(e5);wasm.__wbindgen_exn_store(idx)}}function isLikeNone(x4){return x4==null}function passStringToWasm0(arg,malloc,realloc){if(realloc===void 0){let buf=cachedTextEncoder.encode(arg),ptr2=malloc(buf.length,1)>>>0;return getUint8ArrayMemory0().subarray(ptr2,ptr2+buf.length).set(buf),WASM_VECTOR_LEN=buf.length,ptr2}let len=arg.length,ptr=malloc(len,1)>>>0,mem=getUint8ArrayMemory0(),offset=0;for(;offset<len;offset++){let code=arg.charCodeAt(offset);if(code>127)break;mem[ptr+offset]=code}if(offset!==len){offset!==0&&(arg=arg.slice(offset)),ptr=realloc(ptr,len,len=offset+arg.length*3,1)>>>0;let view=getUint8ArrayMemory0().subarray(ptr+offset,ptr+len),ret=cachedTextEncoder.encodeInto(arg,view);offset+=ret.written,ptr=realloc(ptr,len,offset,1)>>>0}return WASM_VECTOR_LEN=offset,ptr}function takeFromExternrefTable0(idx){let value=wasm.__wbindgen_externrefs.get(idx);return wasm.__externref_table_dealloc(idx),value}var cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});cachedTextDecoder.decode();function decodeText(ptr,len){return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr,ptr+len))}var cachedTextEncoder=new TextEncoder;"encodeInto"in cachedTextEncoder||(cachedTextEncoder.encodeInto=function(arg,view){let buf=cachedTextEncoder.encode(arg);return view.set(buf),{read:arg.length,written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UIghiKjASADQZgCaq2EIaQBIKMBIANBsARqrYQhpQFBBq1CIIYipgEgA0HEAGqthCGnASAUIAEoAlAiFkHQAGxqIRcgASsDQCACKwMAIrcBoxDFAfwCIhhBAWohGSABKwM4ILcBoxDFAfwCIhpBf2ohGyABKwMwILcBoxDFAfwCIhxBAWohHSABKwMoILcBoxDFAfwCIh5Bf2ohHyC1Ab0iowFCIIinISAgASsDICK4Ab0iqAFCIIinISEgA0HwA2pBGGohIiADQfADakEMaiEjIANB2AJqQQRyISQgA0HYAmpBEGohJSADQdgAakEEciEmIANBmAJqQRBqIScgA0HYAmpBCGohKCADQdgCakEEaiEpIAIoAhAhKiACKAIkISsgAigCPCEsIAIoAjghLSACKAI0IS4gAigCLCEvIAIoAighMCACKAIcITEgAioCGCGzASACKAIUITIgA0HYAGpBMGohMyADQdQDaiE0IANB2AJqQewAaiE1IANB2AJqQdwAaiE2IANBpANqITcgA0HYAmpBPGohOCACKwMIIbkBIAIoAiAhOSABKAIYITogowGnITsgqAGnITxBASEGQQAhPQNAIAwhPiA9IQcCQAJAAkADQCAGIT0gCCEMIAMgBzYCRAJAID4oAjRBAkkNACA+KAIAIghBAkcNAgwDCyAMQcgAaiEIID1BAWohBiAMIT4gPSEHIAwgDUcNAAwLCwsCQCAIQQFxRQ0AIANB2AJqID4oAgggPigCDBA7IAMtANgCDQEgAysD4AIhugEMAgsgPisDCCG6AQwBCwJAID4oAhAiCEECRg0AAkAgCEEBcUUNACADQdgCaiA+KAIYID4oAhwQOyADLQDYAg0BIAMrA+ACIboBDAILID4rAxghugEMAQsCQCA6QQJGDQAguAEhugEgOkEBcUUNASADQdgCaiA8ICEQOyADLQDYAg0AIAMrA+ACIboBDAELILYBIboBIBFFDQAgA0HYAmogOyAgEDsCQCADLQDYAg0AIAMrA+ACIboBDAELRJqZmZmZmck/IboBCyC6AUQAAAAAAADgP6IguQGgILcBo5tEAAAAAAAAAAAQlAIhtQEQoAMCQAJAAkBBDEEEEOcCIghFDQAgCCA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HykDADcCACABQRBqIB4pAwA3AgAgAUEYaiASKQMANwIAIAFBIGogEykDADcCACABQShqIBQpAwA3AgAgAUEwaiARKQMANwIAIAFBOGogBCkDADcCACADIA1BAWoiDTYCwAMgD0HIAGohDyAbIA1HDQALIAMoArwDIQ4gAygCuAMhASAbIRwMAgtBCCANEJsCAAsgA0GYAmogA0GoA2oQfSADKAKYAiEEAkACQAJAIAMtAJwCIg9BfmoOAgACAQsgA0GoA2ogA0HPA2pBqJvAABBrIQ5BgICAgHghAQwCC0EAIQ0gA0EANgLAAyADQoCAgICAATcCuANBCCEOQQAhAQJAAkACQCAPQQFxDQAgBBChAiEBQQAoAuy2QSEOQQAoAui2QSENQQBCADcC6LZBIA1BAUYNAUEIIQ9BACENQQghHQNAAkAgARCRAyIFDQAgARCiAiEOCwJAIAFBhAhJDQAgARCpAQsCQAJAIAUNACADQZgCaiAOEDQgAygCnAIhDiADKAKYAiIFQQNHDQEMBAsgAygCvAMhDiADKAK4AyEBDAILIANB6AJqQThqIhEgB0E4aikDADcDACADQegCakEwaiIUIAdBMGopAwA3AwAgA0HoAmpBKGoiEyAHQShqKQMANwMAIANB6AJqQSBqIhIgB0EgaikDADcDACADQegCakEYaiIeIAdBGGopAwA3AwAgA0HoAmpBEGoiHyAHQRBqKQMANwMAIANB6AJqQQhqIhsgB0EIaikDADcDACADIAcpAwA3A+gCAkAgDSADKAK4A0cNACADQbgDahCsASADKAK8AyEdCyAdIA9qIgFBfGogDjYCACABQXhqIAU2AgAgASADKQPoAjcCACABQQhqIBspAwA3AgAgAUEQaiAfKQMANwIAIAFBGGogHikDADcCACABQSBqIBIpAwA3AgAgAUEoaiATKQMANwIAIAFBMGogFCkDADcCACABQThqIBEpAwA3AgAgAyANQQFqIg02AsADIAQQoQIhAUEAKALstkEhDkEAKALotkEhBUEAQgA3Aui2QSAPQcgAaiEPIAVBAUcNAAwCCwsgDSEcIARBgwhNDQMMAQsgA0G4A2oQigFBgICAgHghASAEQYMITQ0CCyAEEK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ANCgICAgIABNwK4A0EIIQFBACENAkACQAJAIA5BAXENACAEEKECIQ1BACgC7LZBIQFBACgC6LZBIQ9BAEIANwLotkEgD0EBRg0BQQghHUEAIQ9ByAAhDgNAAkAgDRCRAyIFDQAgDRCiAiEBCwJAIA1BhAhJDQAgDRCpAQsCQAJAIAUNACADQZgCaiABEDUgAygCmAIhASADKALcAiIFQYCAgIB4Rw0BDAQLIAMoArwDIQEgAygCuAMhDQwCCyADQegCakE4aiIRIAZBOGopAgA3AwAgA0HoAmpBMGoiFCAGQTBqKQIANwMAIANB6AJqQShqIhMgBkEoaikCADcDACADQegCakEgaiISIAZBIGopAgA3AwAgA0HoAmpBGGoiHiAGQRhqKQIANwMAIANB6AJqQRBqIh8gBkEQaikCADcDACADQegCakEIaiIbIAZBCGopAgA3AwAgAyAGKQIANwPoAiADKQPgAiEmAkAgDyADKAK4A0cNACADQbgDahCtASADKAK8AyEdCyAdIA5qIg1BuH9qIAE2AgAgDUG8f2oiASADKQPoAjcCACARKQMAIScgFCkDACEoIBMpAwAhKSASKQMAISogHikDACErIB8pAwAhLCAbKQMAIS0gDSAmNwMAIA1BfGogBTYCACABQQhqIC03AgAgAUEQaiAsNwIAIAFBGGogKzcCACABQSBqICo3AgAgAUEoaiApNwIAIAFBMGogKDcCACABQThqICc3AgAgAyAPQQFqIg82AsADIAQQoQIhDUEAKALstkEhAUEAKALotkEhBUEAQgA3Aui2QSAOQdAAaiEOIAVBAUcNAAwCCwsgDyEgIARBgwhNDQMMAQsgA0G4A2oQfEGAgICAeCENIARBgwhNDQILIAQQqQEMAQtBgICAgHghDSAQQYMITQ0IIAQhAQwBCyAQQYMITQ0BCyAQEKkBCwJAIA1BgICAgHhHDQBBASENIAEhBAwHCwJAIAMoAowCQYCAgIB4Rg0AIANBjAJqEHwLIAMgIDYClAIgAyABNgKQAiADIA02AowCDAELIANBADYC+AEgAyAQNgKoAwJAAkACQCADQagDahDyAQ0AIAMgEDYCuAMCQCADQbgDahDNAg0AIANB6AJqIANBuANqEPgBAkACQAJAAkAgAygC6AJBAUcNACADKQPwAiImQn9VDQELIANBuANqIANBzwNqQciZwAAQayEEDAELICZCgICAgBBUDQEgA0EBOgCYAiADICY3A6ACIANBmAJqIANBzwNqQciZwAAQxwEhBAsgEEGDCE0NCQwICyAQQYQISQ0DIBAQqQEMAwsgAyAQNgLoAiADQZgCaiADQegCahDeAQJAIAMoApgCQQFHDQAgAyADKQOgAiImEK0CIgE2ApgCIANB6AJqIANBmAJqELACIQ0CQCABQYQISQ0AIAEQqQELIA1FDQACQCAQQYQISQ0AIBAQqQELICZCgICAgBBUDQMgA0EBOgCYAiADICY3A6ACIANBmAJqIANBzwNqQciZwAAQxwEhBEEBIQ0MCQsQoANByABBARDnAiIBRQ0BAkBByABFDQAgAUG4nsAAQcgA/AoAAAsgAUHIABCKAyEEIAFByABBARDFAiAQQYQITw0GDAcLAkAgEEGECEkNACAQEKkBC0EAIQoMAgtBAUHIABCbAgALICanISFBASEKCyADKAKAAiIBIAMoAoQCIgVHDQALCwJAAkACQAJAAkACQAJAIAMoAowCQYCAgIB4Rg0AIAMoAqwDQYCAgIB4RiINDQEgJadBAXFFDQICQCALQQNHDQBBAiELCyAKQQJGIQEgA0HoAWpBCGogA0GMAmpBCGooAgA2AgAgA0HYAWpBCGogA0GsA2pBCGooAgA2AgAgAyADKQKMAjcD6AEgAyADKQKsAzcD2AEgDEEDRiENIBatQiCGISYgF60hJwJAIAMoAogCIhBBhAhJDQAgEBCpAQtBACAKIAEbIQFBAiAMIA0bIQUgJiAnhCEmAkAgAygC+AFFDQAgAygC/AEiDUGDCE0NACANEKkBCyADQcgBaiADQegBakEIaigCADYCACADQdQBaiADQdgBakEIaigCADYCACADIAMpA+gBNwPAASADIAMpA9gBNwLMASADIDI5A7gBIAMgMTkDsAEgAyAwOQOoASADIC85A6ABIAMgJjcDmAEgAyAVNgKUASADIAU2ApABIAMgGDYCjAEgAyAZNgKIASADIBo2AoQBIAMgCzYCgAEgAyAhNgJ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YQISQ0AIBAQqQELAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgCQ4KAQIDBAUGBwgJCgALIANBADYC6AIgDUGECEkNDiANEKkBDA4LAkAgJkIBUQ0AIANBADYC6AIgAyANNgK4AyADQfgBaiADQbgDahDdAQJAAkAgAygC+AEiEEEBRw0AIAMpA4ACISgMAQsgA0G4A2ogA0HPA2pBqJzAABBrIQoLAkAgDUGECEkNACANEKkBCwJAIBBFDQBCASEmDA8LQQAhAQwMC0EBIQFB5JTAAEEIENkBIQoMCwsCQCAnQgFRDQAgA0EANgLoAiADIA02ArgDIANB+AFqIANBuANqEN0BAkACQCADKAL4ASIQQQFHDQAgAysDgAIhMgwBCyADQbgDaiADQc8DakGonMAAEGshHAsCQCANQYQISQ0AIA0QqQELAkAgEA0AQQAhASAcIQoMDAtCASEnDA0LQQEhAUHslMAAQQkQ2QEhCgwKCwJAIBFBAUYNACADQQA2AugCIAMgDTYCrAMgA0G4A2ogA0GsA2oQ+AECQAJAAkAgAygCuANBAUcNACADKQPAAyIpQn9VDQELQQEhECADQawDaiADQc8DakG4mcAAEGshFwwBCwJAIClC/////w9WDQAgKachF0EAIRAMAQtBASEQIANBAToA+AEgAyApNwOAAiADQfgBaiADQc8DakG4mcAAEMcBIRcLAkAgDUGECEkNACANEKkBCwJAIBANAEEBIREMDQtBACEBIBchCgwKC0EBIQFB9ZTAAEENENkBIQoMCQsCQCAUQQFGDQAgA0EANgLoAiADIA02AqwDIANBuANqIANBrANqEPgBAkACQCADKAK4A0EBRw0AAkAgAykDwAMiKUKAgICAeHxC/////29WDQAgA0ECOgD4ASADICk3A4ACIANB+AFqIANBzwNqQaiZwAAQxwEhFkEBIRAMAgsgKachFkEAIRAMAQtBASEQIANBrANqIANBzwNqQaiZwAAQayEWCwJAIA1BhAhJDQAgDRCpAQsCQCAQDQBBASEUDAwLQQAhASAWIQoMCQtBASEBQYKVwABBBxDZASEKDAgLAkACQCATQQFGDQAgA0EANgLoAiADIA02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G0uMEANgLAuEFBAEGsuMEANgK0uEFBAEG8uMEANgLIuEFBAEG0uMEANgK8uEFBAEHEuMEANgLQuEFBAEG8uMEANgLEuEFBAEHMuMEANgLYuEFBAEHEuMEANgLMuEFBAEHUuMEANgLguEFBAEHMuMEANgLUuEFBAEHUuMEANgLcuEFBAEHcuMEANgLouEFBAEHcuMEANgLkuEFBAEHkuMEANgLwuEFBAEHkuMEANgLsuEFBAEHsuMEANgL4uEFBAEHsuMEANgL0uEFBAEH0uMEANgKAuUFBAEH0uMEANgL8uEFBAEH8uMEANgKIuUFBAEH8uMEANgKEuUFBAEGEucEANgKQuUFBAEGEucEANgKMuUFBAEGMucEANgKYuUFBAEGMucEANgKUuUFBAEGUucEANgKguUFBAEGcucEANgKouUFBAEGUucEANgKcuUFBAEGkucEANgKwuUFBAEGcucEANgKkuUFBAEGsucEANgK4uUFBAEGkucEANgKsuUFBAEG0ucEANgLAuUFBAEGsucEANgK0uUFBAEG8ucEANgLIuUFBAEG0ucEANgK8uUFBAEHEucEANgLQuUFBAEG8ucEANgLEuUFBAEHMucEANgLYuUFBAEHEucEANgLMuUFBAEHUucEANgLguUFBAEHMucEANgLUuUFBAEHcucEANgLouUFBAEHUucEANgLcuUFBAEHkucEANgLwuUFBAEHcucEANgLkuUFBAEHsucEANgL4uUFBAEHkucEANgLsuUFBAEH0ucEANgKAukFBAEHsucEANgL0uUFBAEH8ucEANgKIukFBAEH0ucEANgL8uUFBAEGEusEANgKQukFBAEH8ucEANgKEukFBAEGMusEANgKYukFBAEGEusEANgKMukFBACAGQQ9qQXhxIgBBeGoiAjYCsLpBQQBBjLrBADYClLpBQQAgBiAAayAJQVhqIgBqQQhqIgc2Aqi6QSACIAdBAXI2AgQgBiAAakEoNgIEQQBBgICAATYCvLpBDAMLIAIgBk8NACAHIAJLDQAgACgCDCIHQQFxDQAgB0EBdiAFRg0BC0EAQQAoAsC6QSIAIAYgACAGSRs2AsC6QSAGIAlqIQdBhLjBACEAAkACQAJAA0Ag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GoiCEH/AXFBCU0NACAFIAdrIQQMBAsgBUF/aiEGAkAgDEIKfiAIrUL/AYN8IgxC//+Pu7rWrfANVg0AIARBAWohBCAFQQFHIQggBiEFIAgNAQsLIAYgB2shBAwCC0EBQQBBAEGsvMAAEOMBAAtBACAKIARqayEECyAOIASsfCENCyADQQBKIQMLAkAgCQ0AIABBAjoAEQ8LIABBADoAECAAIAw3AwggACANNwMACyAAIAM6ABELwgsCCn8CfiMAQfAAayICJAAgAiABNgIgIAJB4ABqIAJBIGoQfSACKAJgIQMCQAJAAkACQAJAAkACQAJAAkAgAi0AZCIEQX5qDgICAAELIABBlYCAgHg2AgAgACADNgIEIAFBgwhLDQYMBwtBACEFIAJBADYCLCACQoCAgICAATcCJAJAIARBAXENACADEKECIQRBACgC7LZBIQZBACgC6LZBIQdBAEIANwLotkECQCAHQQFHDQAMAwtBACEFQRAhB0EIIQgDQAJAIAQQkQMiCQ0AIAQQogIhBgsCQCAEQYQISQ0AIAQQqQELIAkNASACQQhqIAYQ7wEgAigCDCEKIAJB4ABqIAIoAggQViACKAJkIQYCQCACKAJgIglBlYCAgHhHDQBBASELDAULIAIgAikDaCIMNwNYIAIgBjYCVCACIAk2AlAgAkHgAGogChBWAkAgAigCYEGVgICAeEcNACACKAJkIQYgAkHQAGoQhgEMBAsgAkEwakEIaiACQeAAakEIaikDACINNwMAIAJBwABqQQhqIgsgDTcDACACIAIpA2AiDTcDMCACIA03A0ACQCAFIAIoAiRHDQAgAkEkahC0ASACKAIoIQgLIAggB2oiBEF4aiAMNwIAIARBdGogBjYCACAEQXBqIAk2AgAgBCACKQNANwIAIARBCGogCykDADcCACACIAVBAWoiBTYCLEEAIQsgAxChAiEEQQAoAuy2QSEGQQAoAui2QSEJQQBCADcC6LZBIAdBIGohByAJQQFHDQAMBAsLIAAgAikCJDcCACAAQQhqIAJBJGpBCGooAgA2AgAgAyEKIANBgwhNDQQMAwsgAkEYaiACQSBqEPMBAkACQAJAAkAgAigCGEEBcUUNAAJA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fmohAiAFDQALCyAAIANBCGogCSABQQxqKAIAEQsARQ0AQQEhBQwCC0EAIQUgBkEAQQwgBiAHRiICG2ohBCACRQ0ACwsgA0EQaiQAIAUL0AQCB38EfiAAQQhqIQIgACgCACIDQX9qIQQgAUE/ca0hCUEAIQFCACEKAkACQAJAAkADQCADIAFGDQICQCABQYAGRg0AIApCCn4gACABaiIFQQhqMQAAfCIKIAmIQgBSDQIgBCABRg0DIAFBAmohASAKQgp+IAVBCWoxAAB8IgogCYhQDQEMBAsLQYAGQYAGQZiwwAAQzQEACyABQQFqIQEMAQsgClANAQJAIAogCYhCAFENACADIQEMAQsgAyEBA0AgAUEBaiEBIApCCn4iCiAJiFANAAsLIAAgACgCBCABa0EBaiIFNgIEAkACQAJAIAVBgXBIDQBCfyAJhkJ/hSELQQAhBAJAIAMgAU0NAEEAIQVBAEGABiABayIEIARBgAZLGyEGIAEgA2shByACIAFqIQggAyABayEEA0ACQCAGIAVHDQAgASAFakGABkGIsMAAEM0BAAsgCCAFajEAACEMIAIgBWogCiAJiDwAACAMIAogC4NCCn58IQogByAFQQFqIgVqDQALCyAKUA0BA0AgCiIMIAuDQgp+IQogDCAJiKchAQJAAkAgBEGABkkNACABQf8BcUUNASAAQQE6AIgGDAELIAIgBGogAToAACAEQQFqIQQLIApCAFINAAsgACAENgIADAILIABBADoAiAYgAEIANwIADAILIAAgBDYCACAERQ0BCwJAIARBgAZLDQAgBEEHaiEBA0AgACABai0AAA0CIAAgAUF4ajYCACABQX9qIgFBB0cNAAwCCwsgBEF/akGABkGosMAAEM0BAAsL7gQCB38EfiMAQRBrIgQkAAJAAkAgAyAAKAKMAU8NACADIAAoAggiBU8NASABrUIghiACrYQhCyAAKAIEIANBBHRqIgAoAgAiA0FwaiEGIAJB3cvdnnlsIAFqQd3L3Z55bEEPdyIFQRl2IgetQoGChIiQoMCAAX4hDEEAIQggACgCBCIBIAVxIgkhAgJAAkADQAJAIAMgAmopAAAiDSAMhSIOQn+FIA5C//379+/fv/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EEEdiEAIAQNAAsgAUEBQa6uwABBAiACQQZqIANqQQhqQQAgA2sQVCEADAELIAAoAgAhAEEAIQMDQCACQQZqIANqQQdqIABBD3EtALCuQDoAACADQX9qIQMgAEEPSyEEIABBBHYhACAEDQALIAFBAUGursAAQQIgAkEGaiADakEIakEAIANrEFQhAAsgAkEQaiQAIAALpgIBBn8gACgCCCECAkACQCABQYABTw0AQQEhAwwBCwJAIAFBgBBPDQBBAiEDDAELQQNBBCABQYCABEkbIQMLIAIhBAJAIAMgACgCACACa00NACAAIAIgA0EBQQEQmQEgACgCCCEECyAAKAIEIARqIQQCQAJAAkAgAUGAAUkNACABQT9xQYB/ciEFIAFBBnYhBiABQYAQSQ0BIAFBDHYhByAGQT9xQYB/ciEGAkAgAUGAgARJDQAgBCAFOgADIAQgBjoAAiAEIAdBP3FBgH9yOgABIAQgAUESdkFwcjoAAAwDCyAEIAU6AAIgBCAGOgABIAQgB0HgAXI6AAAMAgsgBCABOgAADAELIAQgBToAASAEIAZBwAFyOgAACyAAIAMgAmo2AghBAAuQAgEDfyMAQSBrIgIkAAJAAkACQCABKAIIIgNBgICAEHENACADQYCAgCBxDQEgAUEBQQFBACACQQxqIAAgAkEMakEUEGYiA2pBFCADaxBUIQMMAgtBACEDA0AgAkEMaiADakEPaiAAp0EPcS0Anq5AOgAAIANBf2ohAyAAQg9WIQQgAEIEiCEAIAQNAAsgAUEBQa6uwABBAiACQQxqIANqQRBqQQAgA2sQVCEDDAELQQAhAwNAIAJBDGogA2pBD2ogAKdBD3EtALCuQDoAACADQX9qIQMgAEIPViEEIABCBIghACAEDQALIAFBAUGursAAQQIgAkEMaiADakEQakEAIANrEFQhAwsgAkEgaiQAIAMLogIBBn8gACgCCCECAkACQCABQYABTw0AQQEhAwwBCwJAIAFBgBBPDQBBAiEDDAELQQNBBCABQYCABEkbIQMLIAIhBAJAIAMgACgCACACa00NACAAIAIgAxCiASAAKAIIIQQLIAAoAgQgBGohBAJAAkACQCABQYABSQ0AIAFB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sgAkEQaiQAIAQPC0EBIAQQmwIAC6UBAQN/IwBBEGsiAiQAQQEhAwJAAkACQCABQQFxDQAgAkEEaiAAIAEQciACKAIMIQQgAigCCCEDIAIoAgQhAQwBCyABQQF2IQQCQCABQQJJDQAQoAMgBEEBEOcCIgNFDQILAkAgBEUNACADIAAgBPwKAAALIAQhAQsgAyAEEIoDIQQCQCABRQ0AIAMgAUEBEMUCCyACQRBqJAAgBA8LQQEgBBCbAgALvQEBAX8jAEEQayICJAACQAJAIAApAwBC////////////AINCgICAgICAgPj/AFMNACACQcUArUIghiAArYQ3AwggASgCACABKAIEQe6FwAAgAkEIahBkIQAMAQsgAkEAOgAEIAIgATYCACACQcUArUIghiAArYQ3AwgCQCACQeyhwABB7oXAACACQQhqEGQNAAJAIAItAAQNACABQYSiwABBAhCpAg0BC0EAIQAMAQtBASEACyACQRBqJAAgAAuYAQEBfyMAQRBrIgUkAAJAIAIgAWoiASACTw0AQQBBABCbAgALIAVBBGogACgCACICIAAoAgQgASACQQF0IgIgASACSxsiAkEIQQQgBEEBRhsiASACIAFLGyICIAMgBBCPAQJAIAUoAgRBAUcNACAFKAIIIAUoAgwQmwIACyAFKAIIIQQgACACNgIAIAAgBDYCBCAFQRBqJAALowEBAX8jAEEQayICJAACQAJAIAEQyAJFDQAgAkEEaiABEJIBIABBCGogAkEEakEIaigCADYCACAAIAIpAgQ3AgAMAQsCQCABEMkCRQ0AIAIgARCGAyIBNgIAIAJBBGogAhCSASAAQQhqIAJBBGpBCGooAgA2AgAgACACKQIENwIAIAFBhAhJDQEgARCpAQwBCyAAQYCAgIB4NgIACyACQRBqJAALlAEBA38jAEEQayICJABBAyEDIAAtAAAiACEEAkAgAEEKSQ0AQQEhAyACIAAgAEHkAG4iBEHkAGxrQf8BcUEBdC8AwaxAOwAOCwJAAkAgAEUNACAERQ0BCyACQQ1qIANBf2oiA2ogBEEBdC0AwqxAOgAACyABQQFBAUEAIAJBDWogA2pBAyADaxBUIQMgAkEQaiQAIAML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CIFaiADEKEBIQAgASABIARqIAEgBWogAxChASEBIAIgAiAEaiACIAVqIAMQoQEhAgsgACACIAEgACgCACIDIAEoAgAiBEkiBSAEIAIoAgAiBklzGyAFIAMgBklzGwuKAQEBfyMAQRBrIgMkAAJAIAIgAWoiASACTw0AQQBBABCbAgALIANBBGogACgCACICIAAoAgQgASACQQF0IgIgASACSxsiAkEIIAJBCEsbIgIQpAECQCADKAIEQQFHDQAgAygCCCADKAIMEJsCAAsgAygCCCEBIAAgAjYCACAAIAE2AgQgA0EQaiQAC5YBAgJ/An4jAEEQayIBJAACQAJAIABFDQAgACgCACECIABCADcDACACQQFxRQ0AIAApAxAhAyAAKQMIIQQMAQsgARDSASABKQMIIQMgASkDACEECwJAQQAtANi6QUECRg0AQQBBAToA2LpBQQAgAzcD0LpBQQAgBDcDyLpBIAFBEGokAA8LQeicwABB/QBBqJ3AABDkAQALhwEAAkACQCADQQBODQBBASEBQQQhAkEAIQMMAQsCQAJAAkACQCABRQ0AIAIgAUEBIAMQuwIhAQwBCwJAIAMNAEEBIQEMAgsQoAMgA0EBEOcCIQELIAENAEEBIQEgAEEBNgIEDAELIAAgATYCBEEAIQELQQghAgsgACACaiADNgIAIAAgATYCAAuDAQEBfyMAQSBrIgIkACACQRhqIAAoAgAQ/AIgAiACKAIcIgA2AhQgAiACKAIYNgIQIAIgADYCDCACQT6tQiCGIAJBDGqthDcDGCABKAIAIAEoAgRBk4/AACACQRhqEGQhAQJAIAIoAgwiAEUNACACKAIQIABBARDFAgsgAkEgaiQAIAELbgEGfiAAIANC/////w+DIgUgAUL/////D4MiBn4iByADQiCIIgggBn4iBiAFIAFCIIgiCX58IgVCIIZ8Igo3AwAgACAIIAl+IAUgBlStQiCGIAVCIIiEfCAKIAdUrXwgBCABfiADIAJ+fHw3AwgLiQEBA38jAEEQayIBJAACQCAAKAIAIgIoAgQiA0EBcQ0AIAFBgICAgHg2AgAgASAANgIMIAFB2KLAACAAKAIEIAAoAggiAC0ACCAALQAJEI0BAAsgAigCACECIAEgA0EBdjYCBCABIAI2AgAgAUH0osAAIAAoAgQgACgCCCIALQAIIAAtAAkQjQEAC3IBAX8jAEEQayIFJAACQCABRQ0AIAVBCGogASADIAQgAigCEBENACAAIAUoAggiBEECRiIBNgIIIAAgBSgCDCIDQQAgARs2AgQgAEEAIANBgAggBEEBcRsgARs2AgAgBUEQaiQADwtB+J/AAEEyEOgCAAuHAQEBfwJAAkACQCAAQYQISQ0AIADQbyYBQQAoAvC2QQ0BQQBBfzYC8LZBIABBACgCgLdBIgFJDQIgACABayIAQQAoAvi2QU8NAkEAKALMtkEgAEECdGpBACgC/LZBNgIAQQAgADYC/LZBQQBBACgC8LZBQQFqNgLwtkELDwtBzKDAABCOAwsAC20BA38jAEEQayIBJAAgAUEEaiAAKAIAIgIgACgCBCACQQF0IgJBBCACQQRLGyICQQRBBBCOAQJAIAEoAgRBAUcNACABKAIIIAEoAgwQmwIACyABKAIIIQMgACACNgIAIAAgAzYCBCABQRBqJAALbQEDfyMAQRBrIgEkACABQQRqIAAoAgAiAiAAKAIEIAJBAXQiAkEEIAJBBEsbIgJBBEEMEI4BAkAgASgCBEEBRw0AIAEoAgggASgCDBCbAgALIAEoAgghAyAAIAI2AgAgACADNgIEIAFBEGokAAtuAQN/IwBBEGsiASQAIAFBBGogACgCACICIAAoAgQgAkEBdCICQQQgAkEESxsiAkEIQcgAEI4BAkAgASgCBEEBRw0AIAEoAgggASgCDBCbAgALIAEoAgghAyAAIAI2AgAgACADNgIEIAFBEGokAAtuAQN/IwBBEGsiASQAIAFBBGogACgCACICIAAoAgQgAkEBdCICQQQgAkEESxsiAkEIQdAAEI4BAkAgASgCBEEBRw0AIAEoAgggASgCDBCbAgALIAEoAgghAyAAIAI2AgAgACADNgIEIAFBEGokAAttAQN/IwBBEGsiASQAIAFBBGogACgCACICIAAoAgQgAkEBdCICQQQgAkEESxsiAkEEQRAQjgECQCABKAIEQQFHDQAgASgCCCABKAIMEJsCAAsgASgCCCEDIAAgAj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sLHQEBfwJAIAAoAgAiAUUNACAAKAIEIAFBARDFAgsLFAAgASABIAAgACABYxsgACAAYhsLHAIBfwFvIAAlASABJQEQCCEDEH4iAiADJgEgAgsaACAAJQEgASUBIAEQqQEgAiUBIAIQqQEQCQscAgF/AW8gACUBIAElARAXIQMQfiICIAMmASACCxwCAX8BbyAAJQEgASUBEBghAxB+IgIgAyYBIAILHQAgAEEIakEAKQKYokA3AgAgAEEAKQKQokA3AgALHQAgAEEIakEAKQKookA3AgAgAEEAKQKgokA3AgALFgACQCAARQ0AIAAgARDzAgALENYCAAsVACABaUEBRiAAQYCAgIB4IAFrTXELGgIBfwFvIAAlASABEAIhAxB+IgIgAyYBIAILGgIBfwFvIAAlASABEAchAxB+IgIgAyYBIAILEgAgACABQQF0QQFyIAIQ5AEACxgAIAEoAgAgASgCBCAAKAIAIAAoAgQQZAsYAgF/AW8gACUBEAMhAhB+IgEgAiYBIAELGAIBfwFvIAAlARAFIQIQfiIBIAImASABCxgCAX8BbyAAJQEQDSECEH4iASACJgEgAQsYAgF/AW8gACUBEBQhAhB+IgEgAiYBIAELGAIBfwFvIAAlARAWIQIQfiIBIAImASABCxgCAX8BbyAAIAEQICEDEH4iAiADJgEgAgsYAgF/AW8gACABECwhAxB+IgIgAyYBIAILFQAgACACIAMQpwI2AgQgAEEANgIACxYAIAAoAgAgASACIAAoAgQoAgwRCwALEwAgACUBIAEgAiUBIAIQqQEQBgsWAgF/AW8gABAqIQIQfiIBIAImASABCxYCAX8BbyAAECshAhB+IgEgAiYBIAELFgIBfwFvIAAQLSECEH4iASACJgEgAQsTACAAIAIQqwI2AgQgAEEANgIACxIAIAAoAgAgASgCABDcAkEARwsSACAAKAIAIAEoAgAQ3QJBAEcLEgAgACgCACABKAIAEN4CQQBHCw8AIAAgASACIAMgBBBLAAsUACAAKAIAIAEgACgCBCgCDBEIAAsUACAAKAIAIAEgACgCBCgCEBEIAAsUAgF/AW8QCyEBEH4iACABJgEgAAsUAgF/AW8QDCEBEH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2xvYmFscysTbm9udHJhcHBpbmctZnB0b2ludCsPcmVmZXJlbmNlLXR5cGVzKwhzaWduLWV4dA==";function decodeWasmBase64(base64){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(base64,"base64"));let binary=atob(base64),bytes=new Uint8Array(binary.length);for(let i3=0;i3<binary.length;i3+=1)bytes[i3]=binary.charCodeAt(i3);return bytes}var wasmModule=new WebAssembly.Module(decodeWasmBase64(wasmBase64)),wasmInstance=new WebAssembly.Instance(wasmModule,__wbg_get_imports()),wasm=wasmInstance.exports;wasm.__wbindgen_start()}});var require_s_expression=__commonJS({"node_modules/s-expression/index.js"(exports,module){"use strict";function SParser(stream){this._line=this._col=this._pos=0,this._stream=stream}SParser.not_whitespace_or_end=/^(\S|$)/;SParser.space_quote_paren_escaped_or_end=/^(\s|\\|"|'|`|,|\(|\)|$)/;SParser.string_or_escaped_or_end=/^(\\|"|$)/;SParser.string_delimiters=/["]/;SParser.quotes=/['`,]/;SParser.quotes_map={"'":"quote","`":"quasiquote",",":"unquote"};SParser.prototype={peek,consume,until,error:error2,string,atom,quoted,expr,list};module.exports=function SParse(stream){var parser=new SParse.Parser(stream),expression=parser.expr();return expression instanceof Error?expression:parser.peek()!=""?parser.error("Superfluous characters after expression: `"+parser.peek()+"`"):expression};module.exports.Parser=SParser;module.exports.SyntaxError=Error;function error2(msg){var e5=new Error("Syntax error: "+msg);return e5.line=this._line+1,e5.col=this._col+1,e5}function peek(){return this._stream.length==this._pos?"":this._stream[this._pos]}function consume(){if(this._stream.length==this._pos)return"";var c4=this._stream[this._pos];return this._pos+=1,c4=="\r"?(this.peek()==`
|
|
300
301
|
`&&(this._pos+=1,c4+=`
|
|
301
302
|
`),this._line++,this._col=0):c4==`
|
|
302
303
|
`?(this._line++,this._col=0):this._col++,c4}function until(regex){for(var s3="";!regex.test(this.peek());)s3+=this.consume();return s3}function string(){for(var delimiter=this.consume(),str="";;){str+=this.until(SParser.string_or_escaped_or_end);var next2=this.peek();if(next2=="")return this.error("Unterminated string literal");if(next2==delimiter){this.consume();break}if(next2=="\\"){this.consume(),next2=this.peek(),next2=="r"?(this.consume(),str+="\r"):next2=="t"?(this.consume(),str+=" "):next2=="n"?(this.consume(),str+=`
|
|
@@ -334,7 +335,7 @@ ${face.svg()}`;return svgStr+=`" >
|
|
|
334
335
|
`).map(x4=>x4.match(/\(([^)]+)\)/)[1]).map(parseSinglePoint)}function parseArrayOfLineStrings(str){return str.split(`
|
|
335
336
|
`).map(x4=>x4.match(/\(([^)]+)\)/)[1]).map(parseLineString).reduce((acc,x4)=>[...acc,...x4],[])}function parseWKT(str){if(str.startsWith("POINT")){let pointStr=str.replace(/^POINT \(/,"").replace(/\)$/,"");return parseSinglePoint(pointStr)}else if(str.startsWith("MULTIPOINT")){let multiPointStr=str.replace(/^MULTIPOINT \(/,"").replace(/\)$/,"");return parseMultiPoint(multiPointStr)}else if(str.startsWith("LINESTRING")){let lineStr=str.replace(/^LINESTRING \(/,"").replace(/\)$/,"");return parseLineString(lineStr)}else if(str.startsWith("MULTILINESTRING")){let multilineStr=str.replace(/^MULTILINESTRING /,"");return parseMultiLineString(multilineStr)}else{if(str.startsWith("POLYGON")||str.startsWith("MULTIPOLYGON"))return parsePolygon(str);if(str.startsWith("GEOMETRYCOLLECTION")){let regex=/(?<type>POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON) \((?:[^\(\)]|\([^\)]*\))*\)/g,wktArray=str.match(regex);return wktArray[0].startsWith("GEOMETRYCOLLECTION")&&(wktArray[0]=wktArray[0].replace("GEOMETRYCOLLECTION (","")),wktArray.map(parseWKT).map(x4=>x4 instanceof Array?x4:[x4]).reduce((acc,x4)=>[...acc,...x4],[])}else{if(isArrayOfPoints(str))return parseArrayOfPoints(str);if(isArrayOfLines(str))return parseArrayOfLineStrings(str)}}return[]}function isArrayOfPoints(str){return str.split(`
|
|
336
337
|
`)?.every(str2=>str2.includes("POINT"))}function isArrayOfLines(str){return str.split(`
|
|
337
|
-
`)?.every(str2=>str2.includes("LINESTRING"))}function isWktString(str){return str.startsWith("POINT")||isArrayOfPoints(str)||str.startsWith("LINESTRING")||isArrayOfLines(str)||str.startsWith("MULTILINESTRING")||str.startsWith("POLYGON")||str.startsWith("MULTIPOINT")||str.startsWith("MULTIPOLYGON")||str.startsWith("GEOMETRYCOLLECTION")}Flatten.isWktString=isWktString;Flatten.parseWKT=parseWKT;Flatten.BooleanOperations=BooleanOperations;Flatten.Relations=Relations;init_dist();init_dist5();var package_default={name:"@tscircuit/capacity-autorouter",main:"./dist/index.js",version:"0.0.505",type:"module",files:["dist"],scripts:{start:"cosmos",build:"tsup ./lib/index.ts --minify terser --external @tscircuit/core --external circuit-to-svg --format esm --dts --sourcemap",bench:"bun test tests/spatial-index-bench.test.ts",format:"biome format --write .","format:check":"biome format .","vercel-build":"cosmos-export","run-sample":"bun scripts/run-sample.ts","repomix:lib":"repomix --ignore 'testing/**,**/TwoRouteHighDensitySolver/**,**/RouteStitchingSolver/**,solvers/CapacitySegmentPointOptimizer/CapacitySegmentPointOptimizer.ts' lib","bug-report":"bun run scripts/download-bug-report.ts","bug-report-with-test":"bun run scripts/create-bug-report-test.ts"},devDependencies:{"@biomejs/biome":"^1.9.4","@radix-ui/react-icons":"^1.3.2","@radix-ui/react-menubar":"^1.1.14","@react-hook/resize-observer":"^2.0.2","@resvg/resvg-js":"^2.6.2","@tsci/seveibar.dataset-srj13":"git+https://github.com/tscircuit/dataset-srj13.git#56db70039aeb28a76540fe951b5a96be60f9e949","@tsci/tscircuit.dataset-srj12-bus-routing":"git+https://github.com/tscircuit/dataset-srj12-bus-routing.git#ba82f86a7d1288566b7144eb8661ad2549c5f328","@tscircuit/autorouting-dataset-01":"^1.0.32","@tscircuit/checks":"^0.0.126","@tscircuit/circuit-json-util":"^0.0.94","@tscircuit/core":"^0.0.337","@tscircuit/curvy-trace-solver":"^0.0.10","@tscircuit/dataset-srj05":"git+https://github.com/tscircuit/dataset-srj05.git#9a49c126a89c083dc4d2b72cd17184735f637762","@tscircuit/fixed-via-hypergraph-solver":"https://codeload.github.com/tscircuit/fixed-via-hypergraph-solver/tar.gz/bed37a6201b5dd07c9cc68b828917ecc20d6d049","@tscircuit/hypergraph":"^0.0.71","@tscircuit/jumper-topology-generator":"^0.0.4","@tscircuit/krt-wasm":"^0.1.0","@tscircuit/math-utils":"^0.0.27","@tscircuit/rectdiff":"git+https://github.com/tscircuit/rectdiff.git#4af388d","@tscircuit/solver-utils":"^0.0.16","@types/bun":"^1.2.23","@types/fast-json-stable-stringify":"^2.1.2","@types/object-hash":"^3.0.6","@types/rbush":"^4.0.0","@types/react":"^19.0.8","@types/react-dom":"^19.0.3","@vercel/node":"^5.1.7","@vitejs/plugin-react":"^4.3.4","bun-match-svg":"^0.0.14","circuit-json-to-connectivity-map":"^0.0.19","circuit-json":"^0.0.419","circuit-to-svg":"^0.0.220",clsx:"^2.1.1","dataset-srj11-45-degree":"git+https://github.com/tscircuit/dataset-srj11-45-degree.git#0add61e6a0e6b59f6defc36f257052f773e2d685",flatbush:"^4.4.0","graphics-debug":"0.0.94","high-density-dataset-z04":"git+https://github.com/tscircuit/high-density-dataset-z04.git#b9128ed52f5a50102b6526319be1d4ec33dca2c2",kleur:"^4.1.5","looks-same":"9","pcb-poly-hyper-graph":"https://codeload.github.com/tscircuit/pcb-poly-hyper-graph/tar.gz/80db1463c4a47506eeda15b2c14d59679de900f8",rbush:"^4.0.1",react:"18","react-cosmos":"^6.2.3","react-cosmos-plugin-vite":"^6.2.0","react-dom":"18","react-konva":"18",recharts:"^2.15.1","tailwind-merge":"^3.2.0",terser:"^5.43.1","tiny-hypergraph":"git+https://github.com/tscircuit/tiny-hypergraph.git#78db8cb1dc78bfb3569ea6cb86bacc86d04c7338","tiny-hypergraph-poly":"git+https://github.com/tscircuit/tiny-hypergraph.git#7b93b4c",tsup:"^8.3.6",typescript:"^5.9.3","use-mouse-matrix-transform":"^1.3.0",vite:"^6.0.11","vite-tsconfig-paths":"^5.1.4","zdwiel-dataset":"git+https://github.com/dwiel/tscircuit-benchmark.git#be36518b5bf51755dae92c230061ab3cf4e3e063","high-density-repair01":"git+https://github.com/tscircuit/high-density-repair01.git#f4804e26d6da845cb985e4681ebd528b7c5f2ce8","high-density-repair02":"https://codeload.github.com/tscircuit/high-density-repair02/tar.gz/2afc0cbba3bf2f7eb6b9cd33615d21e9ad9352d4","high-density-repair03":"git+https://github.com/tscircuit/high-density-repair03.git#db73a5f"},dependencies:{"@tscircuit/high-density-a01":"^0.0.37","fast-json-stable-stringify":"^2.1.0","object-hash":"^3.0.0"}};init_dist();init_dist3();var import_react=__toESM(require_react(),1),import_react_reconciler=__toESM(require_react_reconciler(),1),import_constants=__toESM(require_constants(),1);init_zod();init_dist();init_dist();init_zod();init_dist();init_dist();init_dist();init_dist4();init_dist();var import_react2=__toESM(require_react(),1);init_dist4();init_zod();init_zod();init_dist();function createMap(){return new IndexedMap}var IndexedMap=class _IndexedMap{constructor(){__publicField(this,"index",{});__publicField(this,"array",[])}size(){return this.array.length}empty(){return this.array.length===0}itemAt(index){return this.array[index]}contains(key){return this.index[key.id()]!==void 0}find(key){let i3=this.index[key.id()];return i3===void 0?void 0:this.array[i3]}setDefault(key,factory){let i3=this.index[key.id()];if(i3===void 0){let pair=new Pair(key,factory());return this.index[key.id()]=this.array.length,this.array.push(pair),pair}else return this.array[i3]}insert(key,value){let pair=new Pair(key,value),i3=this.index[key.id()];return i3===void 0?(this.index[key.id()]=this.array.length,this.array.push(pair)):this.array[i3]=pair,pair}erase(key){let i3=this.index[key.id()];if(i3===void 0)return;this.index[key.id()]=void 0;let pair=this.array[i3],last=this.array.pop();return pair!==last&&(this.array[i3]=last,this.index[last.first.id()]=i3),pair}copy(){let copy=new _IndexedMap;for(let i3=0;i3<this.array.length;i3++){let pair=this.array[i3].copy();copy.array[i3]=pair,copy.index[pair.first.id()]=i3}return copy}},Pair=class _Pair{constructor(first,second){__publicField(this,"first");__publicField(this,"second");this.first=first,this.second=second}copy(){return new _Pair(this.first,this.second)}};var Variable=class{constructor(name=""){__publicField(this,"_name");__publicField(this,"_value",0);__publicField(this,"_context",null);__publicField(this,"_id",VarId++);this._name=name}id(){return this._id}name(){return this._name}setName(name){this._name=name}context(){return this._context}setContext(context){this._context=context}value(){return this._value}setValue(value){this._value=value}plus(value){return new Expression(this,value)}minus(value){return new Expression(this,typeof value=="number"?-value:[-1,value])}multiply(coefficient){return new Expression([coefficient,this])}divide(coefficient){return new Expression([1/coefficient,this])}toJSON(){return{name:this._name,value:this._value}}toString(){return this._context+"["+this._name+":"+this._value+"]"}},VarId=0;var Expression=class _Expression{constructor(){__publicField(this,"_terms");__publicField(this,"_constant");let parsed=parseArgs(arguments);this._terms=parsed.terms,this._constant=parsed.constant}terms(){return this._terms}constant(){return this._constant}value(){let result=this._constant;for(let i3=0,n4=this._terms.size();i3<n4;i3++){let pair=this._terms.itemAt(i3);result+=pair.first.value()*pair.second}return result}plus(value){return new _Expression(this,value)}minus(value){return new _Expression(this,typeof value=="number"?-value:[-1,value])}multiply(coefficient){return new _Expression([coefficient,this])}divide(coefficient){return new _Expression([1/coefficient,this])}isConstant(){return this._terms.size()==0}toString(){let result=this._terms.array.map(function(pair){return pair.second+"*"+pair.first.toString()}).join(" + ");return!this.isConstant()&&this._constant!==0&&(result+=" + "),result+=this._constant,result}};function parseArgs(args){let constant=0,factory=()=>0,terms=createMap();for(let i3=0,n4=args.length;i3<n4;++i3){let item=args[i3];if(typeof item=="number")constant+=item;else if(item instanceof Variable)terms.setDefault(item,factory).second+=1;else if(item instanceof Expression){constant+=item.constant();let terms2=item.terms();for(let j4=0,k4=terms2.size();j4<k4;j4++){let termPair=terms2.itemAt(j4);terms.setDefault(termPair.first,factory).second+=termPair.second}}else if(item instanceof Array){if(item.length!==2)throw new Error("array must have length 2");let value=item[0],value2=item[1];if(typeof value!="number")throw new Error("array item 0 must be a number");if(value2 instanceof Variable)terms.setDefault(value2,factory).second+=value;else if(value2 instanceof Expression){constant+=value2.constant()*value;let terms2=value2.terms();for(let j4=0,k4=terms2.size();j4<k4;j4++){let termPair=terms2.itemAt(j4);terms.setDefault(termPair.first,factory).second+=termPair.second*value}}else throw new Error("array item 1 must be a variable or expression")}else throw new Error("invalid Expression argument: "+item)}return{terms,constant}}var _Strength=class _Strength{static create(a3,b3,c4,w4=1){let result=0;return result+=Math.max(0,Math.min(1e3,a3*w4))*1e6,result+=Math.max(0,Math.min(1e3,b3*w4))*1e3,result+=Math.max(0,Math.min(1e3,c4*w4)),result}static clip(value){return Math.max(0,Math.min(_Strength.required,value))}};__publicField(_Strength,"required",_Strength.create(1e3,1e3,1e3)),__publicField(_Strength,"strong",_Strength.create(1,0,0)),__publicField(_Strength,"medium",_Strength.create(0,1,0)),__publicField(_Strength,"weak",_Strength.create(0,0,1));var Strength=_Strength;var Operator;(function(Operator2){Operator2[Operator2.Le=0]="Le",Operator2[Operator2.Ge=1]="Ge",Operator2[Operator2.Eq=2]="Eq"})(Operator||(Operator={}));var Constraint=class{constructor(expression,operator,rhs,strength=Strength.required){__publicField(this,"_expression");__publicField(this,"_operator");__publicField(this,"_strength");__publicField(this,"_id",CnId++);this._operator=operator,this._strength=Strength.clip(strength),rhs===void 0&&expression instanceof Expression?this._expression=expression:this._expression=expression.minus(rhs)}id(){return this._id}expression(){return this._expression}op(){return this._operator}strength(){return this._strength}toString(){return this._expression.toString()+" "+["<=",">=","="][this._operator]+" 0 ("+this._strength.toString()+")"}},CnId=0;var Solver=class{constructor(){__publicField(this,"maxIterations",1e3);__publicField(this,"_cnMap",createCnMap());__publicField(this,"_rowMap",createRowMap());__publicField(this,"_varMap",createVarMap());__publicField(this,"_editMap",createEditMap());__publicField(this,"_infeasibleRows",[]);__publicField(this,"_objective",new Row);__publicField(this,"_artificial",null);__publicField(this,"_idTick",0)}createConstraint(lhs,operator,rhs,strength=Strength.required){let cn3=new Constraint(lhs,operator,rhs,strength);return this.addConstraint(cn3),cn3}addConstraint(constraint){if(this._cnMap.find(constraint)!==void 0)throw new Error("duplicate constraint");let data=this._createRow(constraint),row=data.row,tag=data.tag,subject=this._chooseSubject(row,tag);if(subject.type()===SymbolType.Invalid&&row.allDummies())if(nearZero(row.constant()))subject=tag.marker;else throw new Error("unsatisfiable constraint");if(subject.type()===SymbolType.Invalid){if(!this._addWithArtificialVariable(row))throw new Error("unsatisfiable constraint")}else row.solveFor(subject),this._substitute(subject,row),this._rowMap.insert(subject,row);this._cnMap.insert(constraint,tag),this._optimize(this._objective)}removeConstraint(constraint){let cnPair=this._cnMap.erase(constraint);if(cnPair===void 0)throw new Error("unknown constraint");this._removeConstraintEffects(constraint,cnPair.second);let marker=cnPair.second.marker,rowPair=this._rowMap.erase(marker);if(rowPair===void 0){let leaving=this._getMarkerLeavingSymbol(marker);if(leaving.type()===SymbolType.Invalid)throw new Error("failed to find leaving row");rowPair=this._rowMap.erase(leaving),rowPair.second.solveForEx(leaving,marker),this._substitute(marker,rowPair.second)}this._optimize(this._objective)}hasConstraint(constraint){return this._cnMap.contains(constraint)}getConstraints(){return this._cnMap.array.map(({first})=>first)}addEditVariable(variable,strength){if(this._editMap.find(variable)!==void 0)throw new Error("duplicate edit variable");if(strength=Strength.clip(strength),strength===Strength.required)throw new Error("bad required strength");let expr=new Expression(variable),cn3=new Constraint(expr,Operator.Eq,void 0,strength);this.addConstraint(cn3);let info={tag:this._cnMap.find(cn3).second,constraint:cn3,constant:0};this._editMap.insert(variable,info)}removeEditVariable(variable){let editPair=this._editMap.erase(variable);if(editPair===void 0)throw new Error("unknown edit variable");this.removeConstraint(editPair.second.constraint)}hasEditVariable(variable){return this._editMap.contains(variable)}suggestValue(variable,value){let editPair=this._editMap.find(variable);if(editPair===void 0)throw new Error("unknown edit variable");let rows=this._rowMap,info=editPair.second,delta=value-info.constant;info.constant=value;let marker=info.tag.marker,rowPair=rows.find(marker);if(rowPair!==void 0){rowPair.second.add(-delta)<0&&this._infeasibleRows.push(marker),this._dualOptimize();return}let other=info.tag.other;if(rowPair=rows.find(other),rowPair!==void 0){rowPair.second.add(delta)<0&&this._infeasibleRows.push(other),this._dualOptimize();return}for(let i3=0,n4=rows.size();i3<n4;++i3){let rowPair2=rows.itemAt(i3),row=rowPair2.second,coeff=row.coefficientFor(marker);coeff!==0&&row.add(delta*coeff)<0&&rowPair2.first.type()!==SymbolType.External&&this._infeasibleRows.push(rowPair2.first)}this._dualOptimize()}updateVariables(){let vars=this._varMap,rows=this._rowMap;for(let i3=0,n4=vars.size();i3<n4;++i3){let pair=vars.itemAt(i3),rowPair=rows.find(pair.second);rowPair!==void 0?pair.first.setValue(rowPair.second.constant()):pair.first.setValue(0)}}_getVarSymbol(variable){let factory=()=>this._makeSymbol(SymbolType.External);return this._varMap.setDefault(variable,factory).second}_createRow(constraint){let expr=constraint.expression(),row=new Row(expr.constant()),terms=expr.terms();for(let i3=0,n4=terms.size();i3<n4;++i3){let termPair=terms.itemAt(i3);if(!nearZero(termPair.second)){let symbol=this._getVarSymbol(termPair.first),basicPair=this._rowMap.find(symbol);basicPair!==void 0?row.insertRow(basicPair.second,termPair.second):row.insertSymbol(symbol,termPair.second)}}let objective=this._objective,strength=constraint.strength(),tag={marker:INVALID_SYMBOL,other:INVALID_SYMBOL};switch(constraint.op()){case Operator.Le:case Operator.Ge:{let coeff=constraint.op()===Operator.Le?1:-1,slack=this._makeSymbol(SymbolType.Slack);if(tag.marker=slack,row.insertSymbol(slack,coeff),strength<Strength.required){let error2=this._makeSymbol(SymbolType.Error);tag.other=error2,row.insertSymbol(error2,-coeff),objective.insertSymbol(error2,strength)}break}case Operator.Eq:{if(strength<Strength.required){let errplus=this._makeSymbol(SymbolType.Error),errminus=this._makeSymbol(SymbolType.Error);tag.marker=errplus,tag.other=errminus,row.insertSymbol(errplus,-1),row.insertSymbol(errminus,1),objective.insertSymbol(errplus,strength),objective.insertSymbol(errminus,strength)}else{let dummy=this._makeSymbol(SymbolType.Dummy);tag.marker=dummy,row.insertSymbol(dummy)}break}}return row.constant()<0&&row.reverseSign(),{row,tag}}_chooseSubject(row,tag){let cells=row.cells();for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3);if(pair.first.type()===SymbolType.External)return pair.first}let type=tag.marker.type();return(type===SymbolType.Slack||type===SymbolType.Error)&&row.coefficientFor(tag.marker)<0?tag.marker:(type=tag.other.type(),(type===SymbolType.Slack||type===SymbolType.Error)&&row.coefficientFor(tag.other)<0?tag.other:INVALID_SYMBOL)}_addWithArtificialVariable(row){let art=this._makeSymbol(SymbolType.Slack);this._rowMap.insert(art,row.copy()),this._artificial=row.copy(),this._optimize(this._artificial);let success=nearZero(this._artificial.constant());this._artificial=null;let pair=this._rowMap.erase(art);if(pair!==void 0){let basicRow=pair.second;if(basicRow.isConstant())return success;let entering=this._anyPivotableSymbol(basicRow);if(entering.type()===SymbolType.Invalid)return!1;basicRow.solveForEx(art,entering),this._substitute(entering,basicRow),this._rowMap.insert(entering,basicRow)}let rows=this._rowMap;for(let i3=0,n4=rows.size();i3<n4;++i3)rows.itemAt(i3).second.removeSymbol(art);return this._objective.removeSymbol(art),success}_substitute(symbol,row){let rows=this._rowMap;for(let i3=0,n4=rows.size();i3<n4;++i3){let pair=rows.itemAt(i3);pair.second.substitute(symbol,row),pair.second.constant()<0&&pair.first.type()!==SymbolType.External&&this._infeasibleRows.push(pair.first)}this._objective.substitute(symbol,row),this._artificial&&this._artificial.substitute(symbol,row)}_optimize(objective){let iterations=0;for(;iterations<this.maxIterations;){let entering=this._getEnteringSymbol(objective);if(entering.type()===SymbolType.Invalid)return;let leaving=this._getLeavingSymbol(entering);if(leaving.type()===SymbolType.Invalid)throw new Error("the objective is unbounded");let row=this._rowMap.erase(leaving).second;row.solveForEx(leaving,entering),this._substitute(entering,row),this._rowMap.insert(entering,row),iterations++}throw new Error("solver iterations exceeded")}_dualOptimize(){let rows=this._rowMap,infeasible=this._infeasibleRows;for(;infeasible.length!==0;){let leaving=infeasible.pop(),pair=rows.find(leaving);if(pair!==void 0&&pair.second.constant()<0){let entering=this._getDualEnteringSymbol(pair.second);if(entering.type()===SymbolType.Invalid)throw new Error("dual optimize failed");let row=pair.second;rows.erase(leaving),row.solveForEx(leaving,entering),this._substitute(entering,row),rows.insert(entering,row)}}}_getEnteringSymbol(objective){let cells=objective.cells();for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3),symbol=pair.first;if(pair.second<0&&symbol.type()!==SymbolType.Dummy)return symbol}return INVALID_SYMBOL}_getDualEnteringSymbol(row){let ratio=Number.MAX_VALUE,entering=INVALID_SYMBOL,cells=row.cells();for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3),symbol=pair.first,c4=pair.second;if(c4>0&&symbol.type()!==SymbolType.Dummy){let r5=this._objective.coefficientFor(symbol)/c4;r5<ratio&&(ratio=r5,entering=symbol)}}return entering}_getLeavingSymbol(entering){let ratio=Number.MAX_VALUE,found=INVALID_SYMBOL,rows=this._rowMap;for(let i3=0,n4=rows.size();i3<n4;++i3){let pair=rows.itemAt(i3),symbol=pair.first;if(symbol.type()!==SymbolType.External){let row=pair.second,temp=row.coefficientFor(entering);if(temp<0){let temp_ratio=-row.constant()/temp;temp_ratio<ratio&&(ratio=temp_ratio,found=symbol)}}}return found}_getMarkerLeavingSymbol(marker){let dmax=Number.MAX_VALUE,r12=dmax,r22=dmax,invalid=INVALID_SYMBOL,first=invalid,second=invalid,third=invalid,rows=this._rowMap;for(let i3=0,n4=rows.size();i3<n4;++i3){let pair=rows.itemAt(i3),row=pair.second,c4=row.coefficientFor(marker);if(c4===0)continue;let symbol=pair.first;if(symbol.type()===SymbolType.External)third=symbol;else if(c4<0){let r5=-row.constant()/c4;r5<r12&&(r12=r5,first=symbol)}else{let r5=row.constant()/c4;r5<r22&&(r22=r5,second=symbol)}}return first!==invalid?first:second!==invalid?second:third}_removeConstraintEffects(cn3,tag){tag.marker.type()===SymbolType.Error&&this._removeMarkerEffects(tag.marker,cn3.strength()),tag.other.type()===SymbolType.Error&&this._removeMarkerEffects(tag.other,cn3.strength())}_removeMarkerEffects(marker,strength){let pair=this._rowMap.find(marker);pair!==void 0?this._objective.insertRow(pair.second,-strength):this._objective.insertSymbol(marker,-strength)}_anyPivotableSymbol(row){let cells=row.cells();for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3),type=pair.first.type();if(type===SymbolType.Slack||type===SymbolType.Error)return pair.first}return INVALID_SYMBOL}_makeSymbol(type){return new Symbol2(type,this._idTick++)}};function nearZero(value){let eps=1e-8;return value<0?-value<eps:value<eps}function createCnMap(){return createMap()}function createRowMap(){return createMap()}function createVarMap(){return createMap()}function createEditMap(){return createMap()}var SymbolType;(function(SymbolType2){SymbolType2[SymbolType2.Invalid=0]="Invalid",SymbolType2[SymbolType2.External=1]="External",SymbolType2[SymbolType2.Slack=2]="Slack",SymbolType2[SymbolType2.Error=3]="Error",SymbolType2[SymbolType2.Dummy=4]="Dummy"})(SymbolType||(SymbolType={}));var Symbol2=class{constructor(type,id2){__publicField(this,"_id");__publicField(this,"_type");this._id=id2,this._type=type}id(){return this._id}type(){return this._type}},INVALID_SYMBOL=new Symbol2(SymbolType.Invalid,-1),Row=class _Row{constructor(constant=0){__publicField(this,"_cellMap",createMap());__publicField(this,"_constant");this._constant=constant}cells(){return this._cellMap}constant(){return this._constant}isConstant(){return this._cellMap.empty()}allDummies(){let cells=this._cellMap;for(let i3=0,n4=cells.size();i3<n4;++i3)if(cells.itemAt(i3).first.type()!==SymbolType.Dummy)return!1;return!0}copy(){let theCopy=new _Row(this._constant);return theCopy._cellMap=this._cellMap.copy(),theCopy}add(value){return this._constant+=value}insertSymbol(symbol,coefficient=1){let pair=this._cellMap.setDefault(symbol,()=>0);nearZero(pair.second+=coefficient)&&this._cellMap.erase(symbol)}insertRow(other,coefficient=1){this._constant+=other._constant*coefficient;let cells=other._cellMap;for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3);this.insertSymbol(pair.first,pair.second*coefficient)}}removeSymbol(symbol){this._cellMap.erase(symbol)}reverseSign(){this._constant=-this._constant;let cells=this._cellMap;for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3);pair.second=-pair.second}}solveFor(symbol){let cells=this._cellMap,coeff=-1/cells.erase(symbol).second;this._constant*=coeff;for(let i3=0,n4=cells.size();i3<n4;++i3)cells.itemAt(i3).second*=coeff}solveForEx(lhs,rhs){this.insertSymbol(lhs,-1),this.solveFor(rhs)}coefficientFor(symbol){let pair=this._cellMap.find(symbol);return pair!==void 0?pair.second:0}substitute(symbol,row){let pair=this._cellMap.erase(symbol);pair!==void 0&&this.insertRow(row,pair.second)}};var import_debug9=__toESM(require_browser(),1);init_dist6();var import_react3=__toESM(require_react(),1);init_dist();var import_debug10=__toESM(require_browser(),1);init_dist6();init_dist();init_dist3();init_dist6();init_dist6();init_dist6();init_dist3();init_dist();init_dist6();init_dist6();init_src();init_dist6();init_dist3();init_dist6();init_dist3();init_dist6();init_dist3();init_dist6();init_dist6();init_dist3();init_dist6();init_dist6();init_dist3();init_dist6();init_dist6();init_dist3();init_dist6();init_dist3();init_dist6();init_dist6();init_dist6();init_dist6();init_dist6();function distance5(x12,y12,x22,y22){return Math.sqrt((x22-x12)**2+(y22-y12)**2)}var addStartAndEndPortIdsIfMissing=soup=>{let pcbPorts=soup.filter(item=>item.type==="pcb_port"),pcbSmtPads=soup.filter(item=>item.type==="pcb_smtpad"),pcbTraces=soup.filter(item=>item.type==="pcb_trace");function findPortIdOverlappingPoint(point7,options={}){let traceWidth=options.traceWidth||0,directPort=pcbPorts.find(port=>distance5(port.x,port.y,point7.x,point7.y)<.01);if(directPort)return directPort.pcb_port_id;if(options.isFirstOrLastPoint){let smtPad=pcbSmtPads.find(pad2=>{if(pad2.shape==="rect")return Math.abs(point7.x-pad2.x)<pad2.width/2+traceWidth/2&&Math.abs(point7.y-pad2.y)<pad2.height/2+traceWidth/2;if(pad2.shape==="circle")return distance5(point7.x,point7.y,pad2.x,pad2.y)<pad2.radius});if(smtPad)return smtPad.pcb_port_id??null}return null}for(let trace of pcbTraces)for(let index=0;index<trace.route.length;index++){let segment2=trace.route[index],isFirstOrLastPoint=index===0||index===trace.route.length-1;if(segment2.route_type==="wire"){if(!segment2.start_pcb_port_id&&index===0){let startPortId=findPortIdOverlappingPoint(segment2,{isFirstOrLastPoint,traceWidth:segment2.width});startPortId&&(segment2.start_pcb_port_id=startPortId)}if(!segment2.end_pcb_port_id&&index===trace.route.length-1){let endPortId=findPortIdOverlappingPoint(segment2,{isFirstOrLastPoint,traceWidth:segment2.width});endPortId&&(segment2.end_pcb_port_id=endPortId)}}}},CIRCUIT_JSON_ID_PATTERN=/\b(?:pcb|source|schematic|subcircuit)_[a-z0-9_]+\b/i,sanitizeReadableName=(candidate,id2,fallbackLabel)=>!candidate||candidate===id2||CIRCUIT_JSON_ID_PATTERN.test(candidate)?fallbackLabel:candidate,firstReadableName=(candidates,id2)=>{for(let candidate of candidates){let readableName=sanitizeReadableName(candidate,id2,"");if(readableName)return readableName}return""},getReadableNameForComponent=(circuitJson,pcbComponentId)=>sanitizeReadableName(getReadableNameForElement(circuitJson,pcbComponentId),pcbComponentId,"component"),getReadableNameForPort=(circuitJson,pcbPortId)=>{let pcbPort=circuitJson.find(element=>element.type==="pcb_port"&&element.pcb_port_id===pcbPortId);if(pcbPort?.type==="pcb_port"){let sourcePort=circuitJson.find(element=>element.type==="source_port"&&element.source_port_id===pcbPort.source_port_id),sourceComponent=sourcePort?.type==="source_port"?circuitJson.find(element=>element.type==="source_component"&&element.source_component_id===sourcePort.source_component_id):null,readableSourceComponentName=firstReadableName([sourceComponent?.type==="source_component"?sourceComponent.name:null],sourceComponent?.type==="source_component"?sourceComponent.source_component_id:""),readableSourcePortName=firstReadableName([sourcePort?.type==="source_port"?sourcePort.name:null,sourcePort?.type==="source_port"?sourcePort.pin_number?.toString():null,sourcePort?.type==="source_port"?sourcePort.port_hints?.[0]:null],sourcePort?.type==="source_port"?sourcePort.source_port_id:"");if(readableSourceComponentName&&readableSourcePortName)return`${readableSourceComponentName}.${readableSourcePortName}`;if(readableSourcePortName)return readableSourcePortName}return sanitizeReadableName(getReadableNameForPcbPort(circuitJson,pcbPortId)??getReadableNameForElement(circuitJson,pcbPortId),pcbPortId,"port")};var getReadableNameForElementId=(circuitJson,elementId)=>sanitizeReadableName(getReadableNameForElement(circuitJson,elementId),elementId,"element"),containsCircuitJsonId=message=>CIRCUIT_JSON_ID_PATTERN.test(message);function checkEachPcbPortConnectedToPcbTraces(circuitJson){addStartAndEndPortIdsIfMissing(circuitJson);let sourceTraces=circuitJson.filter(item=>item.type==="source_trace"),pcbPorts=circuitJson.filter(item=>item.type==="pcb_port"),errors=[],connectivityMap=getFullConnectivityMapFromCircuitJson(circuitJson),sourcePortToPcbPort=new Map;for(let pcbPort of pcbPorts)sourcePortToPcbPort.set(pcbPort.source_port_id,pcbPort);for(let sourceTrace of sourceTraces){let connectedSourcePortIds=sourceTrace.connected_source_port_ids;if(connectedSourcePortIds.length<2)continue;let pcbPortsInTrace=[],missingPcbPorts=[];for(let sourcePortId of connectedSourcePortIds){let pcbPort=sourcePortToPcbPort.get(sourcePortId);pcbPort?pcbPortsInTrace.push(pcbPort):missingPcbPorts.push(sourcePortId)}if(pcbPortsInTrace.length<2)continue;let firstPcbPort=pcbPortsInTrace[0],referenceNetId=connectivityMap.getNetConnectedToId(firstPcbPort.pcb_port_id);connectivityMap.getIdsConnectedToNet(referenceNetId).filter(id2=>circuitJson.some(element=>element.type==="pcb_trace"&&("pcb_trace_id"in element&&element.pcb_trace_id===id2||"route_id"in element&&element.route_id===id2))).length===0&&new Set(pcbPortsInTrace.map(p4=>p4.pcb_component_id)).size>1&&errors.push({type:"pcb_port_not_connected_error",message:`Ports [${pcbPortsInTrace.map(p4=>getReadableNameForPort(circuitJson,p4.pcb_port_id)).join(", ")}] are not connected together through the same net.`,error_type:"pcb_port_not_connected_error",pcb_port_ids:pcbPortsInTrace.map(p4=>p4.pcb_port_id),pcb_component_ids:pcbPortsInTrace.map(p4=>p4.pcb_component_id).filter(id2=>id2!==void 0),pcb_port_not_connected_error_id:`pcb_port_not_connected_error_trace_${sourceTrace.source_trace_id}`})}return errors}var SpatialObjectIndex=class{constructor({objects,getBounds:getBounds3,getId,CELL_SIZE}){__publicField(this,"buckets");__publicField(this,"objectsById");__publicField(this,"getBounds");__publicField(this,"getId");__publicField(this,"CELL_SIZE",.4);__publicField(this,"_idCounter",0);this.buckets=new Map,this.objectsById=new Map,this.getBounds=getBounds3,this.getId=getId??(()=>this._getNextId()),this.CELL_SIZE=CELL_SIZE??this.CELL_SIZE;for(let obj of objects)this.addObject(obj)}_getNextId(){return`${this._idCounter++}`}addObject(obj){let bounds=this.getBounds(obj),spatialIndexId=this.getId(obj),objWithId={...obj,spatialIndexId};this.objectsById.set(spatialIndexId,objWithId);let minBucketX=Math.floor(bounds.minX/this.CELL_SIZE),minBucketY=Math.floor(bounds.minY/this.CELL_SIZE),maxBucketX=Math.floor(bounds.maxX/this.CELL_SIZE),maxBucketY=Math.floor(bounds.maxY/this.CELL_SIZE);for(let bx3=minBucketX;bx3<=maxBucketX;bx3++)for(let by3=minBucketY;by3<=maxBucketY;by3++){let bucketKey=`${bx3}x${by3}`,bucket=this.buckets.get(bucketKey);bucket?bucket.push(objWithId):this.buckets.set(bucketKey,[objWithId])}}removeObject(id2){let obj=this.objectsById.get(id2);if(!obj)return!1;this.objectsById.delete(id2);let bounds=this.getBounds(obj),minBucketX=Math.floor(bounds.minX/this.CELL_SIZE),minBucketY=Math.floor(bounds.minY/this.CELL_SIZE),maxBucketX=Math.floor(bounds.maxX/this.CELL_SIZE),maxBucketY=Math.floor(bounds.maxY/this.CELL_SIZE);for(let bx3=minBucketX;bx3<=maxBucketX;bx3++)for(let by3=minBucketY;by3<=maxBucketY;by3++){let bucketKey=`${bx3}x${by3}`,bucket=this.buckets.get(bucketKey);if(bucket){let index=bucket.findIndex(item=>item.spatialIndexId===id2);index!==-1&&(bucket.splice(index,1),bucket.length===0&&this.buckets.delete(bucketKey))}}return!0}getBucketKey(x4,y4){return`${Math.floor(x4/this.CELL_SIZE)}x${Math.floor(y4/this.CELL_SIZE)}`}getObjectsInBounds(bounds,margin=0){let objects=[],addedIds=new Set,minBucketX=Math.floor((bounds.minX-margin)/this.CELL_SIZE),minBucketY=Math.floor((bounds.minY-margin)/this.CELL_SIZE),maxBucketX=Math.floor((bounds.maxX+margin)/this.CELL_SIZE),maxBucketY=Math.floor((bounds.maxY+margin)/this.CELL_SIZE);for(let bx3=minBucketX;bx3<=maxBucketX;bx3++)for(let by3=minBucketY;by3<=maxBucketY;by3++){let bucketKey=`${bx3}x${by3}`,bucket=this.buckets.get(bucketKey)||[];for(let obj of bucket){let id2=obj.spatialIndexId;addedIds.has(id2)||(addedIds.add(id2),objects.push(obj))}}return objects}},jlcMinTolerances={min_trace_width:.1,min_via_hole_edge_to_via_hole_edge_clearance:.1,min_plated_hole_drill_edge_to_drill_edge_clearance:.15,min_trace_to_pad_edge_clearance:.1,min_pad_edge_to_pad_edge_clearance:.1,min_board_edge_clearance:.2,min_via_hole_diameter:.2,min_via_pad_diameter:.3},DEFAULT_TRACE_MARGIN=.1,DEFAULT_TRACE_THICKNESS=jlcMinTolerances.min_trace_width,DEFAULT_VIA_DIAMETER=jlcMinTolerances.min_via_pad_diameter,DEFAULT_VIA_BOARD_MARGIN=jlcMinTolerances.min_board_edge_clearance,DEFAULT_SAME_NET_VIA_MARGIN=jlcMinTolerances.min_via_hole_edge_to_via_hole_edge_clearance,DEFAULT_DIFFERENT_NET_VIA_MARGIN=jlcMinTolerances.min_via_hole_edge_to_via_hole_edge_clearance,DEFAULT_PAD_PAD_CLEARANCE=jlcMinTolerances.min_pad_edge_to_pad_edge_clearance,DEFAULT_PAD_TRACE_CLEARANCE=jlcMinTolerances.min_trace_to_pad_edge_clearance,EPSILON2=.005,getPcbBoard=circuitJson=>circuitJson.find(el3=>el3.type==="pcb_board"),getBoardDrcValue=(board,key)=>board?.[key];function getLayersOfPcbElement(obj){return obj.type==="pcb_trace_segment"?[obj.layer]:obj.type==="pcb_smtpad"?[obj.layer]:obj.type==="pcb_plated_hole"?Array.isArray(obj.layers)?obj.layers:[...all_layers]:obj.type==="pcb_hole"?[...all_layers]:obj.type==="pcb_via"?Array.isArray(obj.layers)?obj.layers:[...all_layers]:obj.type==="pcb_keepout"?Array.isArray(obj.layers)?obj.layers:[]:[]}var getClosestPointBetweenSegmentAndBounds=(segment2,bounds)=>{let p12={x:segment2.x1,y:segment2.y1},p22={x:segment2.x2,y:segment2.y2},minX=bounds.minX,minY=bounds.minY,maxX=bounds.maxX,maxY=bounds.maxY;if(p12.x===p22.x&&p12.y===p22.y){let closestX=Math.max(minX,Math.min(maxX,p12.x)),closestY=Math.max(minY,Math.min(maxY,p12.y));return closestX===p12.x&&closestY===p12.y?{x:p12.x,y:p12.y}:{x:closestX,y:closestY}}let dx3=p22.x-p12.x,dy3=p22.y-p12.y,tMinX=dx3!==0?(minX-p12.x)/dx3:Number.NEGATIVE_INFINITY,tMaxX=dx3!==0?(maxX-p12.x)/dx3:Number.POSITIVE_INFINITY,tMinY=dy3!==0?(minY-p12.y)/dy3:Number.NEGATIVE_INFINITY,tMaxY=dy3!==0?(maxY-p12.y)/dy3:Number.POSITIVE_INFINITY,tEnter=Math.max(Math.min(tMinX,tMaxX),Math.min(tMinY,tMaxY)),tExit=Math.min(Math.max(tMinX,tMaxX),Math.max(tMinY,tMaxY));if(tEnter<=tExit&&tExit>=0&&tEnter<=1){let t52=Math.max(0,Math.min(1,tEnter));return{x:p12.x+t52*dx3,y:p12.y+t52*dy3}}let closestToP1={x:Math.max(minX,Math.min(maxX,p12.x)),y:Math.max(minY,Math.min(maxY,p12.y))},closestToP2={x:Math.max(minX,Math.min(maxX,p22.x)),y:Math.max(minY,Math.min(maxY,p22.y))},distToP1Squared=(closestToP1.x-p12.x)**2+(closestToP1.y-p12.y)**2,distToP2Squared=(closestToP2.x-p22.x)**2+(closestToP2.y-p22.y)**2,edges=[{start:{x:minX,y:minY},end:{x:maxX,y:minY}},{start:{x:maxX,y:minY},end:{x:maxX,y:maxY}},{start:{x:maxX,y:maxY},end:{x:minX,y:maxY}},{start:{x:minX,y:maxY},end:{x:minX,y:minY}}],minDistance=Math.min(distToP1Squared,distToP2Squared),closestPoint=distToP1Squared<=distToP2Squared?closestToP1:closestToP2,clamp22=(value,min,max)=>Math.max(min,Math.min(max,value));for(let edge of edges){let va3={x:p22.x-p12.x,y:p22.y-p12.y},vb3={x:edge.end.x-edge.start.x,y:edge.end.y-edge.start.y},w4={x:p12.x-edge.start.x,y:p12.y-edge.start.y},dotAA=va3.x*va3.x+va3.y*va3.y,dotAB=va3.x*vb3.x+va3.y*vb3.y,dotAW=va3.x*w4.x+va3.y*w4.y,dotBB=vb3.x*vb3.x+vb3.y*vb3.y,dotBW=vb3.x*w4.x+vb3.y*w4.y,denominator=dotAA*dotBB-dotAB*dotAB;if(Math.abs(denominator)<1e-10)continue;let tA2=(dotAB*dotBW-dotBB*dotAW)/denominator,tB=(dotAA*dotBW-dotAB*dotAW)/denominator;tA2=clamp22(tA2,0,1),tB=clamp22(tB,0,1);let closestOnSegment={x:p12.x+tA2*va3.x,y:p12.y+tA2*va3.y},closestOnEdge={x:edge.start.x+tB*vb3.x,y:edge.start.y+tB*vb3.y},dx22=closestOnSegment.x-closestOnEdge.x,dy22=closestOnSegment.y-closestOnEdge.y,distSquared=dx22*dx22+dy22*dy22;distSquared<minDistance&&(minDistance=distSquared,closestPoint={x:(closestOnSegment.x+closestOnEdge.x)/2,y:(closestOnSegment.y+closestOnEdge.y)/2})}return closestPoint},getClosestPointBetweenSegments=(segmentA,segmentB)=>{let a12={x:segmentA.x1,y:segmentA.y1},a22={x:segmentA.x2,y:segmentA.y2},b12={x:segmentB.x1,y:segmentB.y1},b22={x:segmentB.x2,y:segmentB.y2},va3={x:a22.x-a12.x,y:a22.y-a12.y},vb3={x:b22.x-b12.x,y:b22.y-b12.y},lenSqrA=va3.x*va3.x+va3.y*va3.y,lenSqrB=vb3.x*vb3.x+vb3.y*vb3.y;if(lenSqrA===0||lenSqrB===0){if(lenSqrA===0&&lenSqrB===0)return{x:(a12.x+b12.x)/2,y:(a12.y+b12.y)/2};if(lenSqrA===0){let t210=clamp4(((a12.x-b12.x)*vb3.x+(a12.y-b12.y)*vb3.y)/lenSqrB,0,1),closestOnB2={x:b12.x+t210*vb3.x,y:b12.y+t210*vb3.y};return{x:(a12.x+closestOnB2.x)/2,y:(a12.y+closestOnB2.y)/2}}let t52=clamp4(((b12.x-a12.x)*va3.x+(b12.y-a12.y)*va3.y)/lenSqrA,0,1),closestOnA2={x:a12.x+t52*va3.x,y:a12.y+t52*va3.y};return{x:(closestOnA2.x+b12.x)/2,y:(closestOnA2.y+b12.y)/2}}let w4={x:a12.x-b12.x,y:a12.y-b12.y},dotAA=va3.x*va3.x+va3.y*va3.y,dotAB=va3.x*vb3.x+va3.y*vb3.y,dotAW=va3.x*w4.x+va3.y*w4.y,dotBB=vb3.x*vb3.x+vb3.y*vb3.y,dotBW=vb3.x*w4.x+vb3.y*w4.y,denominator=dotAA*dotBB-dotAB*dotAB;if(denominator<1e-10)return closestPointsParallelSegments(a12,a22,b12,b22,va3,vb3,lenSqrA,lenSqrB);let tA2=(dotAB*dotBW-dotBB*dotAW)/denominator,tB=(dotAA*dotBW-dotAB*dotAW)/denominator;tA2=clamp4(tA2,0,1),tB=clamp4(tB,0,1),tB=(tA2*dotAB+dotBW)/dotBB,tB=clamp4(tB,0,1),tA2=(tB*dotAB-dotAW)/dotAA,tA2=clamp4(tA2,0,1);let closestOnA={x:a12.x+tA2*va3.x,y:a12.y+tA2*va3.y},closestOnB={x:b12.x+tB*vb3.x,y:b12.y+tB*vb3.y},dx3=closestOnA.x-closestOnB.x,dy3=closestOnA.y-closestOnB.y,distance42=Math.sqrt(dx3*dx3+dy3*dy3);return{x:(closestOnA.x+closestOnB.x)/2,y:(closestOnA.y+closestOnB.y)/2}},closestPointsParallelSegments=(a12,a22,b12,b22,va3,vb3,lenSqrA,lenSqrB)=>{let tA2=((b12.x-a12.x)*va3.x+(b12.y-a12.y)*va3.y)/lenSqrA;tA2=clamp4(tA2,0,1);let pointOnA1={x:a12.x+tA2*va3.x,y:a12.y+tA2*va3.y},tA22=((b22.x-a12.x)*va3.x+(b22.y-a12.y)*va3.y)/lenSqrA;tA22=clamp4(tA22,0,1);let pointOnA2={x:a12.x+tA22*va3.x,y:a12.y+tA22*va3.y},tB=((a12.x-b12.x)*vb3.x+(a12.y-b12.y)*vb3.y)/lenSqrB;tB=clamp4(tB,0,1);let pointOnB1={x:b12.x+tB*vb3.x,y:b12.y+tB*vb3.y},tB2=((a22.x-b12.x)*vb3.x+(a22.y-b12.y)*vb3.y)/lenSqrB;tB2=clamp4(tB2,0,1);let pointOnB2={x:b12.x+tB2*vb3.x,y:b12.y+tB2*vb3.y},closestPair=[{pointA:pointOnA1,pointB:b12,distance:Math.sqrt((pointOnA1.x-b12.x)**2+(pointOnA1.y-b12.y)**2)},{pointA:pointOnA2,pointB:b22,distance:Math.sqrt((pointOnA2.x-b22.x)**2+(pointOnA2.y-b22.y)**2)},{pointA:a12,pointB:pointOnB1,distance:Math.sqrt((a12.x-pointOnB1.x)**2+(a12.y-pointOnB1.y)**2)},{pointA:a22,pointB:pointOnB2,distance:Math.sqrt((a22.x-pointOnB2.x)**2+(a22.y-pointOnB2.y)**2)}].reduce((closest,current3)=>current3.distance<closest.distance?current3:closest);return{x:(closestPair.pointA.x+closestPair.pointB.x)/2,y:(closestPair.pointA.y+closestPair.pointB.y)/2}},clamp4=(value,min,max)=>Math.max(min,Math.min(max,value)),rotatePoint=(point7,angleDegrees)=>{let angle=angleDegrees*Math.PI/180;return{x:point7.x*Math.cos(angle)-point7.y*Math.sin(angle),y:point7.x*Math.sin(angle)+point7.y*Math.cos(angle)}},getRotatedRectPoints=({x:x4,y:y4,width,height,ccwRotation})=>{let halfWidth=width/2,halfHeight=height/2;return[{x:-halfWidth,y:-halfHeight},{x:halfWidth,y:-halfHeight},{x:halfWidth,y:halfHeight},{x:-halfWidth,y:halfHeight}].map(point7=>{let rotated=rotatePoint(point7,ccwRotation);return{x:x4+rotated.x,y:y4+rotated.y}})},getPolygonPointsForPad=pad2=>{if(pad2.type==="pcb_smtpad"){if(pad2.shape==="polygon")return pad2.points;if(pad2.shape==="rotated_rect")return getRotatedRectPoints({x:pad2.x,y:pad2.y,width:pad2.width,height:pad2.height,ccwRotation:pad2.ccw_rotation})}if(pad2.type==="pcb_plated_hole"&&"rect_pad_width"in pad2&&"rect_pad_height"in pad2)return getRotatedRectPoints({x:pad2.x,y:pad2.y,width:pad2.rect_pad_width,height:pad2.rect_pad_height,ccwRotation:"rect_ccw_rotation"in pad2&&typeof pad2.rect_ccw_rotation=="number"?pad2.rect_ccw_rotation:0});throw new Error(`Expected polygonal pad geometry, got ${pad2.type} with shape "${pad2.shape}"`)},getPolygonEdges3=points=>points.map((point7,index)=>[point7,points[(index+1)%points.length]]),getClosestPointsBetweenSegments=(a12,a22,b12,b22)=>{let intersection=getSegmentIntersection(a12,a22,b12,b22);if(intersection)return{distance:0,pointOnA:intersection,pointOnB:intersection,center:intersection};let candidates=[{pointOnA:a12,pointOnB:pointToSegmentClosestPoint(a12,b12,b22)},{pointOnA:a22,pointOnB:pointToSegmentClosestPoint(a22,b12,b22)},{pointOnA:pointToSegmentClosestPoint(b12,a12,a22),pointOnB:b12},{pointOnA:pointToSegmentClosestPoint(b22,a12,a22),pointOnB:b22}],best=candidates[0],bestDistanceSquared=distSq(best.pointOnA,best.pointOnB);for(let candidate of candidates.slice(1)){let candidateDistanceSquared=distSq(candidate.pointOnA,candidate.pointOnB);candidateDistanceSquared<bestDistanceSquared&&(best=candidate,bestDistanceSquared=candidateDistanceSquared)}return{distance:segmentToSegmentMinDistance(a12,a22,b12,b22),pointOnA:best.pointOnA,pointOnB:best.pointOnB,center:{x:(best.pointOnA.x+best.pointOnB.x)/2,y:(best.pointOnA.y+best.pointOnB.y)/2}}},getSegmentToPolygonClearance=(segment2,polygon2)=>{let start={x:segment2.x1,y:segment2.y1},end={x:segment2.x2,y:segment2.y2};if(polygon2.length<3)return{distance:Number.POSITIVE_INFINITY,center:start};let intersections=getPolygonEdges3(polygon2).map(([edgeStart,edgeEnd])=>getSegmentIntersection(start,end,edgeStart,edgeEnd)).filter(point7=>point7!==null);if(intersections.length>0){let dx3=end.x-start.x,dy3=end.y-start.y,lengthSquared=dx3*dx3+dy3*dy3;return intersections.sort((a3,b3)=>{let ta3=((a3.x-start.x)*dx3+(a3.y-start.y)*dy3)/lengthSquared,tb2=((b3.x-start.x)*dx3+(b3.y-start.y)*dy3)/lengthSquared;return ta3-tb2}),{distance:0,center:intersections[0]}}if(isPointInsidePolygon(start,polygon2)||isPointInsidePolygon(end,polygon2))return{distance:0,center:{x:(start.x+end.x)/2,y:(start.y+end.y)/2}};let best=getClosestPointsBetweenSegments(start,end,polygon2[0],polygon2[1]);for(let[edgeStart,edgeEnd]of getPolygonEdges3(polygon2).slice(1)){let candidate=getClosestPointsBetweenSegments(start,end,edgeStart,edgeEnd);candidate.distance<best.distance&&(best=candidate)}return{distance:best.distance,center:best.center}},getCollidableBounds=collidable=>{if(collidable.type==="pcb_trace_segment")return{minX:Math.min(collidable.x1,collidable.x2),minY:Math.min(collidable.y1,collidable.y2),maxX:Math.max(collidable.x1,collidable.x2),maxY:Math.max(collidable.y1,collidable.y2)};if((collidable.type==="pcb_smtpad"||collidable.type==="pcb_plated_hole")&&(collidable.type==="pcb_smtpad"&&(collidable.shape==="rotated_rect"||collidable.shape==="polygon")||collidable.type==="pcb_plated_hole"&&"rect_pad_width"in collidable&&"rect_pad_height"in collidable)){let polygonPoints=getPolygonPointsForPad(collidable);return{minX:Math.min(...polygonPoints.map(point7=>point7.x)),minY:Math.min(...polygonPoints.map(point7=>point7.y)),maxX:Math.max(...polygonPoints.map(point7=>point7.x)),maxY:Math.max(...polygonPoints.map(point7=>point7.y))}}return getBoundsOfPcbElements([collidable])};function getPcbPortIdsConnectedToTrace(trace){let connectedPcbPorts=new Set;for(let segment2 of trace.route)segment2.route_type==="wire"&&(segment2.start_pcb_port_id&&connectedPcbPorts.add(segment2.start_pcb_port_id),segment2.end_pcb_port_id&&connectedPcbPorts.add(segment2.end_pcb_port_id));return Array.from(connectedPcbPorts)}function getPcbPortIdsConnectedToTraces(traces){let connectedPorts=new Set;for(let trace of traces)for(let portId of getPcbPortIdsConnectedToTrace(trace))connectedPorts.add(portId);return Array.from(connectedPorts)}var getRadiusOfCircuitJsonElement=obj=>{if(obj.type==="pcb_via"||obj.type==="pcb_plated_hole"&&obj.shape==="circle")return obj.outer_diameter/2;if(obj.type==="pcb_hole"&&obj.hole_shape==="circle")return obj.hole_diameter/2;if(obj.type==="pcb_smtpad"&&obj.shape==="circle")return obj.radius;throw new Error(`Could not determine radius of element: ${JSON.stringify(obj)}`)};function checkEachPcbTraceNonOverlapping(circuitJson,{connMap,minClearance=DEFAULT_TRACE_MARGIN}={}){let errors=[];addStartAndEndPortIdsIfMissing(circuitJson),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let pcbTraceSegments=cju_default(circuitJson).pcb_trace.list().flatMap(pcbTrace=>{let segments=[];for(let i3=0;i3<pcbTrace.route.length-1;i3++){let p12=pcbTrace.route[i3],p22=pcbTrace.route[i3+1];p12.route_type==="wire"&&p22.route_type==="wire"&&p12.layer===p22.layer&&segments.push({type:"pcb_trace_segment",pcb_trace_id:pcbTrace.pcb_trace_id,_pcbTrace:pcbTrace,thickness:"width"in p12?p12.width:"width"in p22?p22.width:DEFAULT_TRACE_THICKNESS,layer:p12.layer,x1:p12.x,y1:p12.y,x2:p22.x,y2:p22.y})}return segments}),pcbSmtPads=cju_default(circuitJson).pcb_smtpad.list(),pcbPlatedHoles=cju_default(circuitJson).pcb_plated_hole.list(),pcbHoles=cju_default(circuitJson).pcb_hole.list(),pcbVias=cju_default(circuitJson).pcb_via.list(),pcbKeepouts=cju_default(circuitJson).pcb_keepout.list(),allObjects=[...pcbTraceSegments,...pcbSmtPads,...pcbPlatedHoles,...pcbHoles,...pcbVias,...pcbKeepouts],spatialIndex=new SpatialObjectIndex({objects:allObjects,getBounds:getCollidableBounds}),getReadableName=id2=>getReadableNameForElement(circuitJson,id2),constructErrorMessage=(traceName,otherName,gap)=>gap<0?`PCB trace ${traceName} overlaps with ${otherName} (accidental contact)`:`PCB trace ${traceName} is too close to ${otherName} (gap: ${gap.toFixed(3)}mm)`,errorIds=new Set;for(let segmentA of pcbTraceSegments){let requiredMargin=minClearance,bounds=getCollidableBounds(segmentA),nearbyObjects=spatialIndex.getObjectsInBounds(bounds,requiredMargin+segmentA.thickness/2);if(!(segmentA.x1===segmentA.x2&&segmentA.y1===segmentA.y2))for(let obj of nearbyObjects){if(!getLayersOfPcbElement(obj).includes(segmentA.layer))continue;if(obj.type==="pcb_trace_segment"){let segmentB=obj;if(segmentA.layer!==segmentB.layer||connMap.areIdsConnected(segmentA.pcb_trace_id,segmentB.pcb_trace_id))continue;let gap2=segmentToSegmentMinDistance({x:segmentA.x1,y:segmentA.y1},{x:segmentA.x2,y:segmentA.y2},{x:segmentB.x1,y:segmentB.y1},{x:segmentB.x2,y:segmentB.y2})-segmentA.thickness/2-segmentB.thickness/2;if(gap2>minClearance-EPSILON2)continue;let pcb_trace_error_id=`overlap_${segmentA.pcb_trace_id}_${segmentB.pcb_trace_id}`,pcb_trace_error_id_reverse=`overlap_${segmentB.pcb_trace_id}_${segmentA.pcb_trace_id}`;if(errorIds.has(pcb_trace_error_id)||errorIds.has(pcb_trace_error_id_reverse))continue;errorIds.add(pcb_trace_error_id),errors.push({type:"pcb_trace_error",error_type:"pcb_trace_error",message:constructErrorMessage(getReadableName(segmentA.pcb_trace_id),getReadableName(segmentB.pcb_trace_id),gap2),pcb_trace_id:segmentA.pcb_trace_id,source_trace_id:"",pcb_trace_error_id,pcb_component_ids:[],center:getClosestPointBetweenSegments(segmentA,segmentB),pcb_port_ids:getPcbPortIdsConnectedToTraces([segmentA._pcbTrace,segmentB._pcbTrace])});continue}let primaryObjId=getPrimaryId(obj);if(connMap.areIdsConnected(segmentA.pcb_trace_id,"pcb_trace_id"in obj?obj.pcb_trace_id:primaryObjId))continue;if(obj.type==="pcb_via"||obj.type==="pcb_plated_hole"&&obj.shape==="circle"||obj.type==="pcb_hole"||obj.type==="pcb_smtpad"&&obj.shape==="circle"){let radius=getRadiusOfCircuitJsonElement(obj),gap2=segmentToCircleMinDistance({x:segmentA.x1,y:segmentA.y1},{x:segmentA.x2,y:segmentA.y2},{x:obj.x,y:obj.y,radius})-segmentA.thickness/2;if(gap2>minClearance-EPSILON2)continue;let pcb_trace_error_id=`overlap_${segmentA.pcb_trace_id}_${primaryObjId}`;if(errorIds.has(pcb_trace_error_id))continue;errorIds.add(pcb_trace_error_id),errors.push({type:"pcb_trace_error",error_type:"pcb_trace_error",message:constructErrorMessage(getReadableName(segmentA.pcb_trace_id),`${obj.type} "${getReadableName(getPrimaryId(obj))}"`,gap2),pcb_trace_id:segmentA.pcb_trace_id,center:getClosestPointBetweenSegmentAndBounds(segmentA,getCollidableBounds(obj)),source_trace_id:"",pcb_trace_error_id,pcb_component_ids:["pcb_component_id"in obj?obj.pcb_component_id:void 0].filter(Boolean),pcb_port_ids:[...getPcbPortIdsConnectedToTraces([segmentA._pcbTrace]),"pcb_port_id"in obj?obj.pcb_port_id:void 0].filter(Boolean)})}if(obj.type==="pcb_smtpad"&&(obj.shape==="rotated_rect"||obj.shape==="polygon")||obj.type==="pcb_plated_hole"&&"rect_pad_width"in obj&&"rect_pad_height"in obj){let padOutline=getPolygonPointsForPad(obj),{distance:distance42,center:center2}=getSegmentToPolygonClearance(segmentA,padOutline),gap2=distance42-segmentA.thickness/2;if(gap2>minClearance-EPSILON2)continue;let pcb_trace_error_id=`overlap_${segmentA.pcb_trace_id}_${primaryObjId}`;if(errorIds.has(pcb_trace_error_id))continue;errorIds.add(pcb_trace_error_id),errors.push({type:"pcb_trace_error",error_type:"pcb_trace_error",message:constructErrorMessage(getReadableName(segmentA.pcb_trace_id),`${obj.type} "${getReadableName(getPrimaryId(obj))}"`,gap2),pcb_trace_id:segmentA.pcb_trace_id,center:center2,source_trace_id:"",pcb_trace_error_id,pcb_component_ids:["pcb_component_id"in obj?obj.pcb_component_id:void 0].filter(Boolean),pcb_port_ids:[...getPcbPortIdsConnectedToTraces([segmentA._pcbTrace]),"pcb_port_id"in obj?obj.pcb_port_id:void 0].filter(Boolean)});continue}let gap=segmentToBoundsMinDistance({x:segmentA.x1,y:segmentA.y1},{x:segmentA.x2,y:segmentA.y2},getCollidableBounds(obj))-segmentA.thickness/2;if(gap+EPSILON2<requiredMargin){let pcb_trace_error_id=`overlap_${segmentA.pcb_trace_id}_${primaryObjId}`;if(errorIds.has(pcb_trace_error_id))continue;errorIds.add(pcb_trace_error_id),errors.push({type:"pcb_trace_error",error_type:"pcb_trace_error",message:constructErrorMessage(getReadableName(segmentA.pcb_trace_id),`${obj.type} "${getReadableName(getPrimaryId(obj))}"`,gap),pcb_trace_id:segmentA.pcb_trace_id,source_trace_id:"",pcb_trace_error_id,pcb_component_ids:["pcb_component_id"in obj?obj.pcb_component_id:void 0].filter(Boolean),center:getClosestPointBetweenSegmentAndBounds(segmentA,getCollidableBounds(obj)),pcb_port_ids:[...getPcbPortIdsConnectedToTraces([segmentA._pcbTrace]),"pcb_port_id"in obj?obj.pcb_port_id:void 0].filter(Boolean)})}}}return errors}function checkViasOffBoard(circuitJson){let board=getPcbBoard(circuitJson);if(!board)return[];let vias=circuitJson.filter(el3=>el3.type==="pcb_via");if(vias.length===0)return[];if(board.width===void 0||board.height===void 0)return[];let boardEdgeClearance=getBoardDrcValue(board,"min_board_edge_clearance")??jlcMinTolerances.min_board_edge_clearance,boardMinX=board.center.x-board.width/2,boardMaxX=board.center.x+board.width/2,boardMinY=board.center.y-board.height/2,boardMaxY=board.center.y+board.height/2,errors=[];for(let via of vias){let viaRadius=via.outer_diameter/2,viaMinX=via.x-viaRadius,viaMaxX=via.x+viaRadius,viaMinY=via.y-viaRadius,viaMaxY=via.y+viaRadius;if(viaMinX<boardMinX+boardEdgeClearance||viaMaxX>boardMaxX-boardEdgeClearance||viaMinY<boardMinY+boardEdgeClearance||viaMaxY>boardMaxY-boardEdgeClearance){let viaName=getReadableNameForElement(circuitJson,via.pcb_via_id);errors.push({type:"pcb_placement_error",pcb_placement_error_id:`out_of_board_${via.pcb_via_id}`,message:`Via ${viaName} is outside or crossing the board boundary`,error_type:"pcb_placement_error"})}}return errors}function isPolygonCCW(poly){return poly.area()>=0}function rectanglePolygon({center:center2,size:size3,rotationDeg=0}){let cx3=center2.x,cy3=center2.y,hw3=size3.width/2,hh3=size3.height/2,corners=[new Point$3(cx3-hw3,cy3-hh3),new Point$3(cx3+hw3,cy3-hh3),new Point$3(cx3+hw3,cy3+hh3),new Point$3(cx3-hw3,cy3+hh3)],poly=new Polygon$1(corners);if(rotationDeg){let matrix2=rotateDEG(rotationDeg,cx3,cy3),rotatedCorners=corners.map(pt3=>{let p4=applyToPoint(matrix2,{x:pt3.x,y:pt3.y});return new Point$3(p4.x,p4.y)});poly=new Polygon$1(rotatedCorners)}return isPolygonCCW(poly)||poly.reverse(),poly}function boardToPolygon({board}){if(board.outline&&board.outline.length>0){let points=board.outline.map(p4=>new Point$3(p4.x,p4.y)),poly=new Polygon$1(points);return isPolygonCCW(poly)||poly.reverse(),poly}return board.center&&typeof board.width=="number"&&typeof board.height=="number"?rectanglePolygon({center:board.center,size:{width:board.width,height:board.height},rotationDeg:0}):null}function getComponentName({circuitJson,component}){if(component.source_component_id){let sourceComponent=circuitJson.find(el3=>el3.type==="source_component"&&el3.source_component_id===component.source_component_id);if(sourceComponent&&"name"in sourceComponent&&sourceComponent.name)return sourceComponent.name}return getReadableNameForComponent(circuitJson,component.pcb_component_id)}function computeOverlapDistance(compPoly,boardPoly,componentCenter,componentWidth,componentHeight,rotationDeg){let centerPoint=new Point$3(componentCenter.x,componentCenter.y);if(!boardPoly.contains(centerPoint)){let dist=boardPoly.distanceTo(centerPoint);return Array.isArray(dist)?dist[0]:Number(dist)||0}let hw3=componentWidth/2,hh3=componentHeight/2,corners=[{x:componentCenter.x-hw3,y:componentCenter.y-hh3},{x:componentCenter.x+hw3,y:componentCenter.y-hh3},{x:componentCenter.x+hw3,y:componentCenter.y+hh3},{x:componentCenter.x-hw3,y:componentCenter.y+hh3}],midpoints=[];for(let i3=0;i3<4;i3++){let next2=(i3+1)%4;midpoints.push({x:(corners[i3].x+corners[next2].x)/2,y:(corners[i3].y+corners[next2].y)/2})}let matrix2=rotateDEG(rotationDeg,componentCenter.x,componentCenter.y),rotatePoint22=pt3=>{let p4=applyToPoint(matrix2,pt3);return new Point$3(p4.x,p4.y)},rotatedPoints=corners.concat(midpoints).map(rotatePoint22),maxDistance=0;for(let pt3 of rotatedPoints)if(!boardPoly.contains(pt3)){let dist=boardPoly.distanceTo(pt3),d4=Array.isArray(dist)?dist[0]:Number(dist)||0;d4>maxDistance&&(maxDistance=d4)}if(maxDistance>0)return maxDistance;try{let intersection=BooleanOperations.intersect(compPoly,boardPoly),intersectionArea=0;intersection?Array.isArray(intersection)?intersectionArea=intersection.reduce((sum,p4)=>sum+(typeof p4.area=="function"?p4.area():0),0):typeof intersection.area=="function"?intersectionArea=intersection.area():intersectionArea=0:intersectionArea=0;let compArea=compPoly.area();if(intersectionArea>0&&intersectionArea<compArea){let overlapRatio=1-intersectionArea/compArea,compWidth=Math.abs(componentWidth),compHeight=Math.abs(componentHeight);return Math.min(compWidth,compHeight)*overlapRatio}else return .1}catch{return .1}}function getRepositionSuggestion({componentPoly,boardPoly}){let boardBox=boardPoly.box,componentBox=componentPoly.box,deltaX=0,deltaY=0;if(componentBox.xmin<boardBox.xmin?deltaX=boardBox.xmin-componentBox.xmin:componentBox.xmax>boardBox.xmax&&(deltaX=boardBox.xmax-componentBox.xmax),componentBox.ymin<boardBox.ymin?deltaY=boardBox.ymin-componentBox.ymin:componentBox.ymax>boardBox.ymax&&(deltaY=boardBox.ymax-componentBox.ymax),deltaX===0&&deltaY===0)return null;let xDir=deltaX>=0?"right":"left",yDir=deltaY>=0?"up":"down",absDx=Math.abs(Math.round(deltaX*100)/100),absDy=Math.abs(Math.round(deltaY*100)/100);return absDx>0&&absDy>0?`Try moving it ${absDx}mm ${xDir} and ${absDy}mm ${yDir} to fit within the board edge.`:absDx>0?`Try moving it ${absDx}mm ${xDir} to fit within the board edge.`:`Try moving it ${absDy}mm ${yDir} to fit within the board edge.`}function checkPcbComponentsOutOfBoard(circuitJson){let board=circuitJson.find(el3=>el3.type==="pcb_board");if(!board)return[];let boardPoly=boardToPolygon({board});if(!boardPoly)return[];let components=circuitJson.filter(el3=>el3.type==="pcb_component");if(components.length===0)return[];let errors=[];for(let c4 of components){if(c4.is_allowed_to_be_off_board||!c4.center||typeof c4.width!="number"||typeof c4.height!="number"||c4.width<=0||c4.height<=0)continue;let compPoly=rectanglePolygon({center:c4.center,size:{width:c4.width,height:c4.height},rotationDeg:0});if(compPoly.area()===0||boardPoly.contains(compPoly))continue;let overlapDistance=computeOverlapDistance(compPoly,boardPoly,c4.center,c4.width,c4.height,0),compName=getComponentName({circuitJson,component:c4}),overlapDistanceMm=Math.round(overlapDistance*100)/100,repositionSuggestion=getRepositionSuggestion({componentPoly:compPoly,boardPoly});errors.push({type:"pcb_component_outside_board_error",error_type:"pcb_component_outside_board_error",pcb_component_outside_board_error_id:`pcb_component_outside_board_${c4.pcb_component_id}`,message:`Component ${compName} extends outside board boundaries by ${overlapDistanceMm}mm.${repositionSuggestion?` ${repositionSuggestion}`:""}`,pcb_component_id:c4.pcb_component_id,pcb_board_id:board.pcb_board_id,component_center:c4.center,component_bounds:{min_x:compPoly.box.xmin,max_x:compPoly.box.xmax,min_y:compPoly.box.ymin,max_y:compPoly.box.ymax},subcircuit_id:c4.subcircuit_id,source_component_id:c4.source_component_id})}return errors}function distance22(a3,b3){return Math.hypot(a3.x-b3.x,a3.y-b3.y)}function viasAreAtSameLocation(a3,b3){return distance22(a3,b3)<=EPSILON2}function checkSameNetViaSpacing(circuitJson,{connMap,minClearance}={}){let vias=circuitJson.filter(el3=>el3.type==="pcb_via");if(vias.length<2)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_via_hole_edge_to_via_hole_edge_clearance")??jlcMinTolerances.min_via_hole_edge_to_via_hole_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let errors=[],reported=new Set;for(let i3=0;i3<vias.length;i3++)for(let j4=i3+1;j4<vias.length;j4++){let viaA=vias[i3],viaB=vias[j4];if(viasAreAtSameLocation(viaA,viaB)||!connMap.areIdsConnected(viaA.pcb_via_id,viaB.pcb_via_id))continue;let gap=distance22(viaA,viaB)-viaA.hole_diameter/2-viaB.hole_diameter/2;if(gap+EPSILON2>=minClearance)continue;let pairId=[viaA.pcb_via_id,viaB.pcb_via_id].sort().join("_");reported.has(pairId)||(reported.add(pairId),errors.push({type:"pcb_via_clearance_error",pcb_error_id:`same_net_vias_close_${pairId}`,message:`Vias ${getReadableNameForElement(circuitJson,viaA.pcb_via_id)} and ${getReadableNameForElement(circuitJson,viaB.pcb_via_id)} are too close together (gap: ${gap.toFixed(3)}mm)`,error_type:"pcb_via_clearance_error",pcb_via_ids:[viaA.pcb_via_id,viaB.pcb_via_id],minimum_clearance:minClearance,actual_clearance:gap,pcb_center:{x:(viaA.x+viaB.x)/2,y:(viaA.y+viaB.y)/2}}))}return errors}function checkDifferentNetViaSpacing(circuitJson,{connMap,minClearance}={}){let vias=circuitJson.filter(el3=>el3.type==="pcb_via");if(vias.length<2)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_via_hole_edge_to_via_hole_edge_clearance")??jlcMinTolerances.min_via_hole_edge_to_via_hole_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let errors=[],reported=new Set;for(let i3=0;i3<vias.length;i3++)for(let j4=i3+1;j4<vias.length;j4++){let viaA=vias[i3],viaB=vias[j4];if(viasAreAtSameLocation(viaA,viaB)||connMap.areIdsConnected(viaA.pcb_via_id,viaB.pcb_via_id))continue;let gap=distance22(viaA,viaB)-viaA.hole_diameter/2-viaB.hole_diameter/2;if(gap+EPSILON2>=minClearance)continue;let pairId=[viaA.pcb_via_id,viaB.pcb_via_id].sort().join("_");reported.has(pairId)||(reported.add(pairId),errors.push({type:"pcb_via_clearance_error",pcb_error_id:`different_net_vias_close_${pairId}`,message:`Vias ${getReadableNameForElement(circuitJson,viaA.pcb_via_id)} and ${getReadableNameForElement(circuitJson,viaB.pcb_via_id)} from different nets are too close together (gap: ${gap.toFixed(3)}mm)`,error_type:"pcb_via_clearance_error",pcb_via_ids:[viaA.pcb_via_id,viaB.pcb_via_id],minimum_clearance:minClearance,actual_clearance:gap,pcb_center:{x:(viaA.x+viaB.x)/2,y:(viaA.y+viaB.y)/2}}))}return errors}var getSourceTraceIdsFromPcbTrace=pcbTraceSourceTraceId=>pcbTraceSourceTraceId?pcbTraceSourceTraceId.includes("__")?pcbTraceSourceTraceId.split("__").filter(part=>part.startsWith("source_trace_")):[pcbTraceSourceTraceId]:[];function checkSourceTracesHavePcbTraces(circuitJson){let errors=[],sourceTraces=circuitJson.filter(el3=>el3.type==="source_trace"),pcbTraces=circuitJson.filter(el3=>el3.type==="pcb_trace");for(let sourceTrace of sourceTraces){if(!sourceTrace.connected_source_port_ids?.length||(sourceTrace.connected_source_net_ids?.length??0)>0||sourceTrace.connected_source_port_ids.length<2)continue;if(!pcbTraces.some(pcbTrace=>getSourceTraceIdsFromPcbTrace(pcbTrace.source_trace_id).includes(sourceTrace.source_trace_id))){let connectedPcbPorts=circuitJson.filter(el3=>el3.type==="pcb_port"&&sourceTrace.connected_source_port_ids.includes(el3.source_port_id)),connectedPcbComponentIds=Array.from(new Set(connectedPcbPorts.map(port=>port.pcb_component_id).filter(id2=>id2!==void 0)));errors.push({type:"pcb_trace_missing_error",pcb_trace_missing_error_id:`pcb_trace_missing_${sourceTrace.source_trace_id}`,error_type:"pcb_trace_missing_error",message:`Trace [${sourceTrace.display_name&&!containsCircuitJsonId(sourceTrace.display_name)?sourceTrace.display_name:"trace"}] is not connected (it has no PCB trace)`,source_trace_id:sourceTrace.source_trace_id,pcb_component_ids:connectedPcbComponentIds,pcb_port_ids:connectedPcbPorts.map(port=>port.pcb_port_id)})}}return errors}function getBoardPolygonPoints(board){if(board.outline&&board.outline.length>0)return board.outline.map(p4=>({x:p4.x,y:p4.y}));if(board.center&&typeof board.width=="number"&&typeof board.height=="number"){let cx3=board.center.x,cy3=board.center.y,hw3=board.width/2,hh3=board.height/2;return[{x:cx3-hw3,y:cy3-hh3},{x:cx3+hw3,y:cy3-hh3},{x:cx3+hw3,y:cy3+hh3},{x:cx3-hw3,y:cy3+hh3}]}return null}function checkPcbTracesOutOfBoard(circuitJson,config={}){let errors=[],board=getPcbBoard(circuitJson);if(!board)return errors;let margin=config.margin??getBoardDrcValue(board,"min_board_edge_clearance")??jlcMinTolerances.min_board_edge_clearance,boardPoints=getBoardPolygonPoints(board);if(!boardPoints)return errors;let pcbTraces=cju_default(circuitJson).pcb_trace.list();for(let trace of pcbTraces)if(!(trace.route.length<2))for(let i3=0;i3<trace.route.length-1;i3++){let p12=trace.route[i3],p22=trace.route[i3+1];if(p12.route_type!=="wire"||p22.route_type!=="wire")continue;let traceWidth="width"in p12?p12.width:"width"in p22?p22.width:.1,segmentStart={x:p12.x,y:p12.y},segmentEnd={x:p22.x,y:p22.y},minDistance=Number.POSITIVE_INFINITY;for(let j4=0;j4<boardPoints.length;j4++){let edgeStart=boardPoints[j4],edgeEnd=boardPoints[(j4+1)%boardPoints.length],distance42=segmentToSegmentMinDistance(segmentStart,segmentEnd,edgeStart,edgeEnd);distance42<minDistance&&(minDistance=distance42)}let minimumDistance=traceWidth/2+margin;if(minDistance<minimumDistance){let error2={type:"pcb_trace_error",error_type:"pcb_trace_error",pcb_trace_error_id:`trace_too_close_to_board_${trace.pcb_trace_id}_segment_${i3}`,message:`Trace too close to board edge (${minDistance.toFixed(3)}mm < ${minimumDistance.toFixed(3)}mm required, margin: ${margin}mm)`,pcb_trace_id:trace.pcb_trace_id,source_trace_id:trace.source_trace_id||"",center:{x:(segmentStart.x+segmentEnd.x)/2,y:(segmentStart.y+segmentEnd.y)/2},pcb_component_ids:[],pcb_port_ids:[]};errors.push(error2)}}return errors}function getElementLayers(elem){return getLayersOfPcbElement(elem)}function doLayersOverlap(layers1,layers2){return layers1.length===0||layers2.length===0?!0:layers1.some(l4=>layers2.includes(l4))}function doPcbElementsOverlap(elem1,elem2){let layers1=getElementLayers(elem1),layers2=getElementLayers(elem2);if(!doLayersOverlap(layers1,layers2))return!1;let bounds1=getBoundsOfPcbElements([elem1]),bounds2=getBoundsOfPcbElements([elem2]);return doBoundsOverlap(bounds1,bounds2)}var formatOverlapElementDescription=(circuitJson,element)=>{if("pcb_port_id"in element&&element.pcb_port_id)return getReadableNameForPort(circuitJson,element.pcb_port_id);let id2=getPrimaryId(element),readableName=getReadableNameForElementId(circuitJson,id2);return readableName==="element"?`[${id2}]`:readableName};function checkPcbComponentOverlap(circuitJson){let errors=[],connMap=getFullConnectivityMapFromCircuitJson(circuitJson),smtPads=cju_default(circuitJson).pcb_smtpad.list(),platedHoles=cju_default(circuitJson).pcb_plated_hole.list(),holes=cju_default(circuitJson).pcb_hole.list(),componentMap=new Map;for(let pad2 of smtPads){let componentId=pad2.pcb_component_id||`standalone_pad_${getPrimaryId(pad2)}`;componentMap.has(componentId)||componentMap.set(componentId,{component_id:componentId,elements:[],bounds:{minX:0,minY:0,maxX:0,maxY:0}}),componentMap.get(componentId).elements.push(pad2)}for(let hole of platedHoles){let componentId=hole.pcb_component_id||`standalone_plated_hole_${getPrimaryId(hole)}`;componentMap.has(componentId)||componentMap.set(componentId,{component_id:componentId,elements:[],bounds:{minX:0,minY:0,maxX:0,maxY:0}}),componentMap.get(componentId).elements.push(hole)}for(let hole of holes){let componentId=`standalone_hole_${getPrimaryId(hole)}`;componentMap.set(componentId,{component_id:componentId,elements:[hole],bounds:{minX:0,minY:0,maxX:0,maxY:0}})}for(let[componentId,componentData]of componentMap)componentData.elements.length>0&&(componentData.bounds=getBoundsOfPcbElements(componentData.elements));let componentsWithElements=Array.from(componentMap.values());for(let i3=0;i3<componentsWithElements.length;i3++)for(let j4=i3+1;j4<componentsWithElements.length;j4++){let comp1=componentsWithElements[i3],comp2=componentsWithElements[j4];if(doBoundsOverlap(comp1.bounds,comp2.bounds))for(let elem1 of comp1.elements)for(let elem2 of comp2.elements){let id1=getPrimaryId(elem1),id2=getPrimaryId(elem2);if(!(elem1.type==="pcb_smtpad"&&elem2.type==="pcb_smtpad"&&connMap.areIdsConnected(id1,id2))&&doPcbElementsOverlap(elem1,elem2)){let elem1Description=formatOverlapElementDescription(circuitJson,elem1),elem2Description=formatOverlapElementDescription(circuitJson,elem2),error2={type:"pcb_footprint_overlap_error",pcb_error_id:`pcb_footprint_overlap_${id1}_${id2}`,error_type:"pcb_footprint_overlap_error",message:`${elem1.type} ${elem1Description} overlaps with ${elem2.type} ${elem2Description}`};(elem1.type==="pcb_smtpad"||elem2.type==="pcb_smtpad")&&(error2.pcb_smtpad_ids=[],elem1.type==="pcb_smtpad"&&error2.pcb_smtpad_ids.push(id1),elem2.type==="pcb_smtpad"&&error2.pcb_smtpad_ids.push(id2)),(elem1.type==="pcb_plated_hole"||elem2.type==="pcb_plated_hole")&&(error2.pcb_plated_hole_ids=[],elem1.type==="pcb_plated_hole"&&error2.pcb_plated_hole_ids.push(id1),elem2.type==="pcb_plated_hole"&&error2.pcb_plated_hole_ids.push(id2)),(elem1.type==="pcb_hole"||elem2.type==="pcb_hole")&&(error2.pcb_hole_ids=[],elem1.type==="pcb_hole"&&error2.pcb_hole_ids.push(id1),elem2.type==="pcb_hole"&&error2.pcb_hole_ids.push(id2)),errors.push(error2)}}}return errors}var formatMm=value=>{let rounded=Math.round(value*1e3)/1e3;return`${Number(rounded.toFixed(3))}mm`},getPadBounds=pad2=>getBoundsOfPcbElements([pad2]),getPadCenter=pad2=>{let bounds=getPadBounds(pad2);return midpoint({x:bounds.minX,y:bounds.minY},{x:bounds.maxX,y:bounds.maxY})},getPadRadius=pad2=>{let bounds=getPadBounds(pad2);return Math.min(bounds.maxX-bounds.minX,bounds.maxY-bounds.minY)/2},isCircularPad=pad2=>pad2.shape==="circle",getCircleShape=pad2=>{let center2=getPadCenter(pad2);return{kind:"circle",x:center2.x,y:center2.y,radius:getPadRadius(pad2)}},getPolygonShape=pad2=>{let bounds=getPadBounds(pad2);return{kind:"polygon",points:[{x:bounds.minX,y:bounds.minY},{x:bounds.maxX,y:bounds.minY},{x:bounds.maxX,y:bounds.maxY},{x:bounds.minX,y:bounds.maxY}]}},getPadToPadGap=(padA,padB)=>isCircularPad(padA)&&isCircularPad(padB)?distanceBetweenCircleAndCircle(getCircleShape(padA),getCircleShape(padB)):isCircularPad(padA)?distanceBetweenCircleAndPolygon(getCircleShape(padA),getPolygonShape(padB)):isCircularPad(padB)?distanceBetweenCircleAndPolygon(getCircleShape(padB),getPolygonShape(padA)):distanceBetweenPolygonAndPolygon(getPolygonShape(padA),getPolygonShape(padB)),getPads=circuitJson=>[...cju_default(circuitJson).pcb_smtpad.list(),...cju_default(circuitJson).pcb_plated_hole.list()],getTraceSegments=circuitJson=>cju_default(circuitJson).pcb_trace.list().flatMap(pcbTrace=>{let segments=[];for(let i3=0;i3<pcbTrace.route.length-1;i3++){let p12=pcbTrace.route[i3],p22=pcbTrace.route[i3+1];p12.route_type==="wire"&&p22.route_type==="wire"&&p12.layer===p22.layer&&segments.push({type:"pcb_trace_segment",pcb_trace_id:pcbTrace.pcb_trace_id,_pcbTrace:pcbTrace,thickness:"width"in p12?p12.width:"width"in p22?p22.width:DEFAULT_TRACE_THICKNESS,layer:p12.layer,x1:p12.x,y1:p12.y,x2:p22.x,y2:p22.y})}return segments});function checkPadPadClearance(circuitJson,{connMap,minClearance}={}){let pads=getPads(circuitJson);if(pads.length<2)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_pad_edge_to_pad_edge_clearance")??jlcMinTolerances.min_pad_edge_to_pad_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let spatialIndex=new SpatialObjectIndex({objects:pads,getBounds:getPadBounds,getId:pad2=>getPrimaryId(pad2)}),errors=new Map;for(let padA of pads){let padAId=getPrimaryId(padA),nearbyPads=spatialIndex.getObjectsInBounds(getPadBounds(padA),minClearance);for(let padB of nearbyPads){let padBId=getPrimaryId(padB);if(padAId===padBId||!getLayersOfPcbElement(padA).some(layer=>getLayersOfPcbElement(padB).includes(layer))||connMap.areIdsConnected(padAId,padBId))continue;let pairId=[padAId,padBId].sort().join("_"),gap=getPadToPadGap(padA,padB);if(gap+EPSILON2>=minClearance)continue;let centerA=getPadCenter(padA),centerB=getPadCenter(padB),nextError={type:"pcb_pad_pad_clearance_error",pcb_pad_pad_clearance_error_id:`pad_pad_clearance_${pairId}`,error_type:"pcb_pad_pad_clearance_error",message:`Pads ${getReadableNameForElement(circuitJson,padAId)} and ${getReadableNameForElement(circuitJson,padBId)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(minClearance)})`,pcb_pad_ids:[padAId,padBId],minimum_clearance:minClearance,actual_clearance:gap,center:{x:(centerA.x+centerB.x)/2,y:(centerA.y+centerB.y)/2}};errors.has(pairId)||errors.set(pairId,nextError)}}return Array.from(errors.values())}function checkPadTraceClearance(circuitJson,{connMap,minClearance}={}){let pads=getPads(circuitJson),segments=getTraceSegments(circuitJson);if(pads.length===0||segments.length===0)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_trace_to_pad_edge_clearance")??jlcMinTolerances.min_trace_to_pad_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let spatialIndex=new SpatialObjectIndex({objects:pads,getBounds:getPadBounds,getId:pad2=>getPrimaryId(pad2)}),errors=new Map;for(let segment2 of segments){let nearbyPads=spatialIndex.getObjectsInBounds(getCollidableBounds(segment2),minClearance+segment2.thickness/2);for(let pad2 of nearbyPads){let padId=getPrimaryId(pad2);if(!getLayersOfPcbElement(pad2).includes(segment2.layer)||connMap.areIdsConnected(segment2.pcb_trace_id,padId))continue;let center2=getPadCenter(pad2),gap=isCircularPad(pad2)?segmentToCircleMinDistance({x:segment2.x1,y:segment2.y1},{x:segment2.x2,y:segment2.y2},{x:center2.x,y:center2.y,radius:getPadRadius(pad2)})-segment2.thickness/2:segmentToBoundsMinDistance({x:segment2.x1,y:segment2.y1},{x:segment2.x2,y:segment2.y2},getPadBounds(pad2))-segment2.thickness/2;if(gap+EPSILON2>=minClearance)continue;let pairId=`${padId}_${segment2.pcb_trace_id}`,nextError={type:"pcb_pad_trace_clearance_error",pcb_pad_trace_clearance_error_id:`pad_trace_clearance_${pairId}`,error_type:"pcb_pad_trace_clearance_error",message:`Pad ${getReadableNameForElement(circuitJson,padId)} and trace ${getReadableNameForElement(circuitJson,segment2.pcb_trace_id)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(minClearance)})`,pcb_pad_id:padId,pcb_trace_id:segment2.pcb_trace_id,minimum_clearance:minClearance,actual_clearance:gap,center:{x:(center2.x+(segment2.x1+segment2.x2)/2)/2,y:(center2.y+(segment2.y1+segment2.y2)/2)/2}},current3=errors.get(pairId);(!current3||gap<current3.gap)&&errors.set(pairId,{error:nextError,gap})}}return Array.from(errors.values()).map(({error:error2})=>error2)}var getClosestPointOnSegment=(point7,segmentStart,segmentEnd)=>{let dx3=segmentEnd.x-segmentStart.x,dy3=segmentEnd.y-segmentStart.y,lengthSquared=dx3*dx3+dy3*dy3;if(lengthSquared===0)return segmentStart;let t52=Math.max(0,Math.min(1,((point7.x-segmentStart.x)*dx3+(point7.y-segmentStart.y)*dy3)/lengthSquared));return{x:segmentStart.x+t52*dx3,y:segmentStart.y+t52*dy3}};function checkViaTraceClearance(circuitJson,{connMap,minClearance}={}){let vias=circuitJson.filter(el3=>el3.type==="pcb_via"),segments=getTraceSegments(circuitJson);if(vias.length===0||segments.length===0)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_trace_to_pad_edge_clearance")??jlcMinTolerances.min_trace_to_pad_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let errors=new Map;for(let via of vias){let viaRadius=via.outer_diameter/2;for(let segment2 of segments){if(!getLayersOfPcbElement(via).includes(segment2.layer)||connMap.areIdsConnected(segment2.pcb_trace_id,via.pcb_via_id))continue;let gap=segmentToCircleMinDistance({x:segment2.x1,y:segment2.y1},{x:segment2.x2,y:segment2.y2},{x:via.x,y:via.y,radius:viaRadius})-segment2.thickness/2;if(gap+EPSILON2>=minClearance)continue;let closestPoint=getClosestPointOnSegment({x:via.x,y:via.y},{x:segment2.x1,y:segment2.y1},{x:segment2.x2,y:segment2.y2}),pairId=`${via.pcb_via_id}_${segment2.pcb_trace_id}`,nextError={type:"pcb_via_trace_clearance_error",pcb_via_trace_clearance_error_id:`via_trace_clearance_${pairId}`,error_type:"pcb_via_trace_clearance_error",message:`Via ${getReadableNameForElement(circuitJson,via.pcb_via_id)} and trace ${getReadableNameForElement(circuitJson,segment2.pcb_trace_id)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(minClearance)})`,pcb_via_id:via.pcb_via_id,pcb_trace_id:segment2.pcb_trace_id,minimum_clearance:minClearance,actual_clearance:gap,center:{x:(via.x+closestPoint.x)/2,y:(via.y+closestPoint.y)/2}},current3=errors.get(pairId);(!current3||gap<current3.gap)&&errors.set(pairId,{error:nextError,gap})}}return Array.from(errors.values()).map(({error:error2})=>error2)}function checkPinMustBeConnected(circuitJson){let errors=[],sourceComponents=circuitJson.filter(el3=>"source_component_id"in el3&&(el3.type==="source_component"||el3.type.startsWith("source_simple_"))),sourcePorts=circuitJson.filter(el3=>el3.type==="source_port"),sourceTraces=circuitJson.filter(el3=>el3.type==="source_trace"),connectedPortIds=new Set;for(let trace of sourceTraces)for(let portId of trace.connected_source_port_ids??[])connectedPortIds.add(portId);let componentInternalConnections=new Map;for(let component of sourceComponents)"internally_connected_source_port_ids"in component&&component.internally_connected_source_port_ids&&componentInternalConnections.set(component.source_component_id,component.internally_connected_source_port_ids);for(let internalGroups of componentInternalConnections.values())for(let group of internalGroups)if(group.some(portId=>connectedPortIds.has(portId)))for(let portId of group)connectedPortIds.add(portId);for(let port of sourcePorts)if(port.must_be_connected===!0&&!connectedPortIds.has(port.source_port_id)){let componentName=sourceComponents.find(c4=>c4.source_component_id===port.source_component_id)?.name??"Unknown";errors.push({type:"source_pin_must_be_connected_error",source_pin_must_be_connected_error_id:`source_pin_must_be_connected_error_${port.source_port_id}`,error_type:"source_pin_must_be_connected_error",message:`Port ${port.name} on ${componentName} must be connected but is floating`,source_component_id:port.source_component_id??"",source_port_id:port.source_port_id,subcircuit_id:port.subcircuit_id})}return errors}var PIN_ATTRIBUTE_KEYS=["must_be_connected","provides_power","requires_power","provides_ground","requires_ground","provides_voltage","requires_voltage","do_not_connect","include_in_board_pinout","can_use_internal_pullup","is_using_internal_pullup","needs_external_pullup","can_use_internal_pulldown","is_using_internal_pulldown","needs_external_pulldown","can_use_open_drain","is_using_open_drain","can_use_push_pull","is_using_push_pull","should_have_decoupling_capacitor","recommended_decoupling_capacitor_capacitance","is_configured_for_i2c_sda","is_configured_for_i2c_scl","is_configured_for_spi_mosi","is_configured_for_spi_miso","is_configured_for_spi_sck","is_configured_for_spi_cs","is_configured_for_uart_tx","is_configured_for_uart_rx","supports_i2c_sda","supports_i2c_scl","supports_spi_mosi","supports_spi_miso","supports_spi_sck","supports_spi_cs","supports_uart_tx","supports_uart_rx"];function hasAnyPinAttribute(port){return PIN_ATTRIBUTE_KEYS.some(key=>port[key]!==void 0)}function checkAllPinsInComponentAreUnderspecified(circuitJson){let warnings=[],db2=cju_default(circuitJson),sourceComponents=db2.source_component.list(),sourcePorts=db2.source_port.list(),portsByComponent=new Map;for(let port of sourcePorts){if(!port.source_component_id)continue;let existing=portsByComponent.get(port.source_component_id)??[];existing.push(port),portsByComponent.set(port.source_component_id,existing)}for(let component of sourceComponents){if(component.ftype!=="simple_chip")continue;let componentPorts=portsByComponent.get(component.source_component_id)??[];componentPorts.length===0||componentPorts.some(port=>hasAnyPinAttribute(port))||warnings.push({type:"source_component_pins_underspecified_warning",source_component_pins_underspecified_warning_id:`source_component_pins_underspecified_warning_${component.source_component_id}`,warning_type:"source_component_pins_underspecified_warning",message:`All pins on ${component.name} are underspecified (no pinAttributes set)`,source_component_id:component.source_component_id,source_port_ids:componentPorts.map(port=>port.source_port_id),subcircuit_id:componentPorts[0]?.subcircuit_id})}return warnings}function checkNoPowerPinDefined(circuitJson){let warnings=[],db2=cju_default(circuitJson),sourceComponents=db2.source_component.list(),sourcePorts=db2.source_port.list(),portsByComponent=new Map;for(let port of sourcePorts){if(!port.source_component_id)continue;let existing=portsByComponent.get(port.source_component_id)??[];existing.push(port),portsByComponent.set(port.source_component_id,existing)}for(let component of sourceComponents){if(component.ftype!=="simple_chip")continue;let componentPorts=portsByComponent.get(component.source_component_id)??[];componentPorts.length===0||componentPorts.some(port=>port.requires_power===!0)||warnings.push({type:"source_no_power_pin_defined_warning",source_no_power_pin_defined_warning_id:`source_no_power_pin_defined_warning_${component.source_component_id}`,warning_type:"source_no_power_pin_defined_warning",message:`${component.name} has no pin with requires_power=true`,source_component_id:component.source_component_id,source_port_ids:componentPorts.map(port=>port.source_port_id),subcircuit_id:componentPorts[0]?.subcircuit_id})}return warnings}function checkNoGroundPinDefined(circuitJson){let warnings=[],db2=cju_default(circuitJson),sourceComponents=db2.source_component.list(),sourcePorts=db2.source_port.list(),portsByComponent=new Map;for(let port of sourcePorts){if(!port.source_component_id)continue;let existing=portsByComponent.get(port.source_component_id)??[];existing.push(port),portsByComponent.set(port.source_component_id,existing)}for(let component of sourceComponents){if(component.ftype!=="simple_chip")continue;let componentPorts=portsByComponent.get(component.source_component_id)??[];componentPorts.length===0||componentPorts.some(port=>port.requires_ground===!0)||warnings.push({type:"source_no_ground_pin_defined_warning",source_no_ground_pin_defined_warning_id:`source_no_ground_pin_defined_warning_${component.source_component_id}`,warning_type:"source_no_ground_pin_defined_warning",message:`${component.name} has no pin with requires_ground=true`,source_component_id:component.source_component_id,source_port_ids:componentPorts.map(port=>port.source_port_id),subcircuit_id:componentPorts[0]?.subcircuit_id})}return warnings}function getFacingDirectionFromInsertionDirection(component){switch(component.insertion_direction){case"from_left":return"x-";case"from_right":return"x+";case"from_front":return"y+";case"from_back":return"y-";case"from_above":return null;default:return null}}function getFacingDirection(component){if(component.insertion_direction)return getFacingDirectionFromInsertionDirection(component);if(!component.center||!component.cable_insertion_center)return null;let dx3=component.cable_insertion_center.x-component.center.x,dy3=component.cable_insertion_center.y-component.center.y;return Math.abs(dx3)<1e-6&&Math.abs(dy3)<1e-6?null:Math.abs(dx3)>=Math.abs(dy3)?dx3>=0?"x+":"x-":dy3>=0?"y+":"y-"}function getRecommendedFacingDirection(component,bounds){if(!component.center)return null;let distances=[{direction:"x-",distance:component.center.x-bounds.minX},{direction:"x+",distance:bounds.maxX-component.center.x},{direction:"y-",distance:component.center.y-bounds.minY},{direction:"y+",distance:bounds.maxY-component.center.y}];return distances.sort((a3,b3)=>a3.distance-b3.distance),distances[0]?.direction??null}function checkConnectorAccessibleOrientation(circuitJson){let board=circuitJson.find(el3=>el3.type==="pcb_board");if(!board)return[];let bounds=(()=>{try{return getBoardBounds(board)}catch{return null}})();if(!bounds)return[];let warnings=[],components=circuitJson.filter(el3=>el3.type==="pcb_component");for(let component of components){let facingDirection=getFacingDirection(component),recommendedFacingDirection=getRecommendedFacingDirection(component,bounds);if(!facingDirection||!recommendedFacingDirection||facingDirection===recommendedFacingDirection)continue;let componentName=getReadableNameForComponent(circuitJson,component.pcb_component_id);warnings.push({type:"pcb_connector_not_in_accessible_orientation_warning",warning_type:"pcb_connector_not_in_accessible_orientation_warning",pcb_connector_not_in_accessible_orientation_warning_id:`pcb_connector_not_in_accessible_orientation_warning_${component.pcb_component_id}`,message:`${componentName} is facing ${facingDirection} but should face ${recommendedFacingDirection} so the connector is accessible from the board edge`,pcb_component_id:component.pcb_component_id,source_component_id:component.source_component_id,pcb_board_id:board.pcb_board_id,facing_direction:facingDirection,recommended_facing_direction:recommendedFacingDirection,subcircuit_id:component.subcircuit_id})}return warnings}function getCourtyardPolygon(el3){if(el3.type==="pcb_courtyard_rect"){let hw3=el3.width/2,hh3=el3.height/2,corners=[{x:-hw3,y:-hh3},{x:+hw3,y:-hh3},{x:+hw3,y:+hh3},{x:-hw3,y:+hh3}],angle=(el3.ccw_rotation??0)*Math.PI/180,cos6=Math.cos(angle),sin6=Math.sin(angle);return corners.map(({x:x4,y:y4})=>({x:el3.center.x+x4*cos6-y4*sin6,y:el3.center.y+x4*sin6+y4*cos6}))}return el3.type==="pcb_courtyard_circle"?Array.from({length:32},(_4,i3)=>{let a3=2*Math.PI*i3/32;return{x:el3.center.x+el3.radius*Math.cos(a3),y:el3.center.y+el3.radius*Math.sin(a3)}}):el3.outline}function getComponentName2(circuitJson,pcbComponentId){let pcbComponent=circuitJson.find(el3=>el3.type==="pcb_component"&&el3.pcb_component_id===pcbComponentId);if(pcbComponent?.type!=="pcb_component")return pcbComponentId;let sourceComponent=circuitJson.find(el3=>el3.type==="source_component"&&el3.source_component_id===pcbComponent.source_component_id);return sourceComponent?.type==="source_component"&&sourceComponent.name?sourceComponent.name:pcbComponentId}function polygonsOverlap(polyA,polyB){if(polyA.some(p4=>isPointInsidePolygon(p4,polyB))||polyB.some(p4=>isPointInsidePolygon(p4,polyA)))return!0;for(let i3=0;i3<polyA.length;i3++){let a12=polyA[i3],a22=polyA[(i3+1)%polyA.length];for(let j4=0;j4<polyB.length;j4++){let b12=polyB[j4],b22=polyB[(j4+1)%polyB.length];if(doSegmentsIntersect(a12,a22,b12,b22))return!0}}return!1}function checkCourtyardOverlap(circuitJson){let courtyards=circuitJson.filter(el3=>el3.type==="pcb_courtyard_rect"||el3.type==="pcb_courtyard_circle"||el3.type==="pcb_courtyard_outline"),byComponent=new Map;for(let el3 of courtyards){let id2=el3.pcb_component_id;byComponent.has(id2)||byComponent.set(id2,[]),byComponent.get(id2).push(el3)}let componentIds=Array.from(byComponent.keys()),errors=[];for(let i3=0;i3<componentIds.length;i3++)for(let j4=i3+1;j4<componentIds.length;j4++){let idA=componentIds[i3],idB=componentIds[j4],overlapping=!1;outer:for(let a3 of byComponent.get(idA))for(let b3 of byComponent.get(idB)){if("layer"in a3&&"layer"in b3&&a3.layer!==b3.layer)continue;let polyA=getCourtyardPolygon(a3),polyB=getCourtyardPolygon(b3);if(polygonsOverlap(polyA,polyB)){overlapping=!0;break outer}}overlapping&&errors.push({type:"pcb_courtyard_overlap_error",pcb_error_id:`pcb_courtyard_overlap_${idA}_${idB}`,error_type:"pcb_courtyard_overlap_error",message:`Courtyard of ${getComponentName2(circuitJson,idA)} overlaps with courtyard of ${getComponentName2(circuitJson,idB)}`,pcb_component_ids:[idA,idB]})}return errors}function distance32(x12,y12,x22,y22){return Math.sqrt((x22-x12)**2+(y22-y12)**2)}function isPointInPad(point7,pad2){if(pad2.type==="pcb_smtpad"){if(pad2.shape==="circle")return distance32(point7.x,point7.y,pad2.x,pad2.y)<=pad2.radius;if(pad2.shape==="rect"){let halfWidth=pad2.width/2,halfHeight=pad2.height/2;return Math.abs(point7.x-pad2.x)<=halfWidth&&Math.abs(point7.y-pad2.y)<=halfHeight}if(pad2.shape==="rotated_rect"){let dx3=point7.x-pad2.x,dy3=point7.y-pad2.y,angle=-pad2.ccw_rotation,rotatedX=dx3*Math.cos(angle)-dy3*Math.sin(angle),rotatedY=dx3*Math.sin(angle)+dy3*Math.cos(angle);return Math.abs(rotatedX)<=pad2.width/2&&Math.abs(rotatedY)<=pad2.height/2}if(pad2.shape==="pill"){let halfWidth=pad2.width/2,halfHeight=pad2.height/2,radius=pad2.radius;if(Math.abs(point7.x-pad2.x)<=halfWidth-radius&&Math.abs(point7.y-pad2.y)<=halfHeight)return!0;let cornerX=Math.max(Math.abs(point7.x-pad2.x)-(halfWidth-radius),0),cornerY=Math.max(Math.abs(point7.y-pad2.y)-(halfHeight-radius),0);return cornerX*cornerX+cornerY*cornerY<=radius*radius}}if(pad2.type==="pcb_plated_hole"){if(pad2.shape==="circle")return distance32(point7.x,point7.y,pad2.x,pad2.y)<=pad2.outer_diameter/2;if(pad2.shape==="oval"||pad2.shape==="pill")return Math.abs(point7.x-pad2.x)<=pad2.outer_width/2&&Math.abs(point7.y-pad2.y)<=pad2.outer_height/2;if(pad2.shape==="circular_hole_with_rect_pad"||pad2.shape==="pill_hole_with_rect_pad")return Math.abs(point7.x-pad2.x)<=pad2.rect_pad_width/2&&Math.abs(point7.y-pad2.y)<=pad2.rect_pad_height/2}return!1}function checkTracesAreContiguous(circuitJson){let errors=[],pcbPorts=circuitJson.filter(el3=>el3.type==="pcb_port"),pcbTraces=circuitJson.filter(el3=>el3.type==="pcb_trace"),sourceTraces=circuitJson.filter(el3=>el3.type==="source_trace"),pcbSmtPads=circuitJson.filter(el3=>el3.type==="pcb_smtpad"),pcbPlatedHoles=circuitJson.filter(el3=>el3.type==="pcb_plated_hole"),padMap=new Map;for(let pad2 of pcbSmtPads)pad2.pcb_port_id&&padMap.set(pad2.pcb_port_id,pad2);for(let hole of pcbPlatedHoles)hole.pcb_port_id&&padMap.set(hole.pcb_port_id,hole);for(let trace of pcbTraces){if(trace.route.length===0)continue;let firstPoint=trace.route[0],lastPoint=trace.route[trace.route.length-1],sourceTrace=sourceTraces.find(st3=>st3.source_trace_id===trace.source_trace_id),expectedPorts=sourceTrace?pcbPorts.filter(port=>sourceTrace.connected_source_port_ids?.includes(port.source_port_id)):[];for(let i3=1;i3<trace.route.length-1;i3++){let prevPoint=trace.route[i3-1],currentPoint=trace.route[i3],nextPoint=trace.route[i3+1];if(currentPoint.route_type==="via"){let prevIsWire=prevPoint.route_type==="wire",nextIsWire=nextPoint.route_type==="wire";if(prevIsWire&&nextIsWire){let prevAligned=Math.abs(prevPoint.x-currentPoint.x)<.01&&Math.abs(prevPoint.y-currentPoint.y)<.01,nextAligned=Math.abs(nextPoint.x-currentPoint.x)<.01&&Math.abs(nextPoint.y-currentPoint.y)<.01;if(!prevAligned||!nextAligned){let traceName2=getReadableNameForPcbTrace(circuitJson,trace.pcb_trace_id);errors.push({type:"pcb_trace_error",message:`Via in trace [${traceName2}] is misaligned at position {x: ${currentPoint.x}, y: ${currentPoint.y}}.`,source_trace_id:sourceTrace?.source_trace_id||trace.source_trace_id||`!${trace.pcb_trace_id}`,error_type:"pcb_trace_error",pcb_trace_id:trace.pcb_trace_id,pcb_trace_error_id:`misaligned_via_${trace.pcb_trace_id}_${i3}`,pcb_component_ids:[],pcb_port_ids:[]})}}}}let traceName=getReadableNameForPcbTrace(circuitJson,trace.pcb_trace_id);for(let port of expectedPorts){if(!port.pcb_port_id)continue;let pad2=padMap.get(port.pcb_port_id);if(!pad2)continue;let isFirstPointConnected=firstPoint.route_type==="wire"&&isPointInPad({x:firstPoint.x,y:firstPoint.y},pad2),isLastPointConnected=lastPoint.route_type==="wire"&&isPointInPad({x:lastPoint.x,y:lastPoint.y},pad2);if(!isFirstPointConnected&&!isLastPointConnected){let portName=getReadableNameForPcbPort(circuitJson,port.pcb_port_id).replace("pcb_port",""),padType=pad2.type.replace(/pcb_/,""),errorCenter={x:(firstPoint.x+lastPoint.x)/2,y:(firstPoint.y+lastPoint.y)/2};errors.push({type:"pcb_trace_error",message:`Trace [${traceName}] is missing a connection to ${padType}${portName}`,source_trace_id:sourceTrace?.source_trace_id||trace.source_trace_id||`!${trace.pcb_trace_id}`,error_type:"pcb_trace_error",pcb_trace_id:trace.pcb_trace_id,pcb_trace_error_id:`missing_connection_${trace.pcb_trace_id}_${port.pcb_port_id}`,center:errorCenter,pcb_component_ids:[],pcb_port_ids:[port.pcb_port_id]})}}if(expectedPorts.length===0){let firstConnectsToAnyPad=!1,lastConnectsToAnyPad=!1,endpointsAreSame=firstPoint.route_type==="wire"&&lastPoint.route_type==="wire"&&Math.abs(firstPoint.x-lastPoint.x)<.01&&Math.abs(firstPoint.y-lastPoint.y)<.01;for(let[portId,pad2]of padMap)firstPoint.route_type==="wire"&&isPointInPad({x:firstPoint.x,y:firstPoint.y},pad2)&&(firstConnectsToAnyPad=!0),lastPoint.route_type==="wire"&&isPointInPad({x:lastPoint.x,y:lastPoint.y},pad2)&&(lastConnectsToAnyPad=!0);!firstConnectsToAnyPad&&firstPoint.route_type==="wire"&&errors.push({type:"pcb_trace_error",message:`Trace [${traceName}] has disconnected endpoint at (${firstPoint.x.toFixed(2)}, ${firstPoint.y.toFixed(2)})`,source_trace_id:sourceTrace?.source_trace_id||trace.source_trace_id||`!${trace.pcb_trace_id}`,error_type:"pcb_trace_error",pcb_trace_id:trace.pcb_trace_id,pcb_trace_error_id:`disconnected_endpoint_${trace.pcb_trace_id}_start`,center:{x:firstPoint.x,y:firstPoint.y},pcb_component_ids:[],pcb_port_ids:[]}),!lastConnectsToAnyPad&&lastPoint.route_type==="wire"&&!(endpointsAreSame&&!firstConnectsToAnyPad)&&errors.push({type:"pcb_trace_error",message:`Trace [${traceName}] has disconnected endpoint at (${lastPoint.x.toFixed(2)}, ${lastPoint.y.toFixed(2)})`,source_trace_id:sourceTrace?.source_trace_id||trace.source_trace_id||`!${trace.pcb_trace_id}`,error_type:"pcb_trace_error",pcb_trace_id:trace.pcb_trace_id,pcb_trace_error_id:`disconnected_endpoint_${trace.pcb_trace_id}_end`,center:{x:lastPoint.x,y:lastPoint.y},pcb_component_ids:[],pcb_port_ids:[]})}}return errors}async function runAllPlacementChecks(circuitJson){return[...checkViasOffBoard(circuitJson),...checkPcbComponentsOutOfBoard(circuitJson),...checkPcbComponentOverlap(circuitJson),...checkPadPadClearance(circuitJson),...checkPadTraceClearance(circuitJson),...checkCourtyardOverlap(circuitJson),...checkConnectorAccessibleOrientation(circuitJson)]}async function runAllNetlistChecks(circuitJson){return[...checkPinMustBeConnected(circuitJson)]}async function runAllPinSpecificationChecks(circuitJson){return[...checkAllPinsInComponentAreUnderspecified(circuitJson),...checkNoPowerPinDefined(circuitJson),...checkNoGroundPinDefined(circuitJson)]}async function runAllRoutingChecks(circuitJson){return[...checkEachPcbPortConnectedToPcbTraces(circuitJson),...checkSourceTracesHavePcbTraces(circuitJson),...checkEachPcbTraceNonOverlapping(circuitJson),...checkViaTraceClearance(circuitJson),...checkSameNetViaSpacing(circuitJson),...checkDifferentNetViaSpacing(circuitJson),...checkTracesAreContiguous(circuitJson),...checkPcbTracesOutOfBoard(circuitJson)]}init_dist6();var SI_PREFIXES=[{value:1e12,symbol:"T"},{value:1e9,symbol:"G"},{value:1e6,symbol:"M"},{value:1e3,symbol:"k"},{value:1,symbol:""},{value:.001,symbol:"m"},{value:1e-6,symbol:"\xB5"},{value:1e-9,symbol:"n"},{value:1e-12,symbol:"p"}];function formatSiUnit(value){if(value==null)return"";if(value===0)return"0";let absValue=Math.abs(value),prefix=SI_PREFIXES.find(p4=>{let scaled2=absValue/p4.value;return scaled2>=1&&scaled2<1e3})||SI_PREFIXES[SI_PREFIXES.length-1],formatted=(value/prefix.value).toPrecision(3);return formatted.includes(".")&&!/\.0+$/.test(formatted)&&(formatted=formatted.replace(/0+$/,"")),formatted=formatted.replace(/\.0+$/,""),`${formatted}${prefix.symbol}`}init_dist6();init_dist();var FlatQueue=class{constructor(){this.ids=[],this.values=[],this.length=0}clear(){this.length=0}push(item,priority){let pos=this.length++;for(;pos>0;){let parent=pos-1>>1,parentValue=this.values[parent];if(priority>=parentValue)break;this.ids[pos]=this.ids[parent],this.values[pos]=parentValue,pos=parent}this.ids[pos]=item,this.values[pos]=priority}pop(){if(this.length===0)return;let ids=this.ids,values=this.values,top=ids[0],last=--this.length;if(last>0){let id2=ids[last],value=values[last],pos=0,halfLen=last>>1;for(;pos<halfLen;){let left=(pos<<1)+1,right=left+1,child=left+(+(right<last)&+(values[right]<values[left]));if(values[child]>=value)break;ids[pos]=ids[child],values[pos]=values[child],pos=child}ids[pos]=id2,values[pos]=value}return top}peek(){return this.length>0?this.ids[0]:void 0}peekValue(){return this.length>0?this.values[0]:void 0}shrink(){this.ids.length=this.values.length=this.length}};var ARRAY_TYPES=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],VERSION=3,Flatbush=class _Flatbush{static from(data,byteOffset=0){if(byteOffset%8!==0)throw new Error("byteOffset must be 8-byte aligned.");if(!data||data.byteLength===void 0||data.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[magic,versionAndType]=new Uint8Array(data,byteOffset+0,2);if(magic!==251)throw new Error("Data does not appear to be in a Flatbush format.");let version2=versionAndType>>4;if(version2!==VERSION)throw new Error(`Got v${version2} data when expected v${VERSION}.`);let ArrayType=ARRAY_TYPES[versionAndType&15];if(!ArrayType)throw new Error("Unrecognized array type.");let[nodeSize]=new Uint16Array(data,byteOffset+2,1),[numItems]=new Uint32Array(data,byteOffset+4,1);return new _Flatbush(numItems,nodeSize,ArrayType,void 0,data,byteOffset)}constructor(numItems,nodeSize=16,ArrayType=Float64Array,ArrayBufferType=ArrayBuffer,data,byteOffset=0){if(numItems===void 0)throw new Error("Missing required argument: numItems.");if(isNaN(numItems)||numItems<=0)throw new Error(`Unexpected numItems value: ${numItems}.`);this.numItems=+numItems,this.nodeSize=Math.min(Math.max(+nodeSize,2),65535),this.byteOffset=byteOffset;let n4=numItems,numNodes=n4;this._levelBounds=[n4*4];do n4=Math.ceil(n4/this.nodeSize),numNodes+=n4,this._levelBounds.push(numNodes*4);while(n4!==1);this.ArrayType=ArrayType,this.IndexArrayType=numNodes<16384?Uint16Array:Uint32Array;let arrayTypeIndex=ARRAY_TYPES.indexOf(ArrayType),nodesByteSize=numNodes*4*ArrayType.BYTES_PER_ELEMENT;if(arrayTypeIndex<0)throw new Error(`Unexpected typed array class: ${ArrayType}.`);if(data)this.data=data,this._boxes=new ArrayType(data,byteOffset+8,numNodes*4),this._indices=new this.IndexArrayType(data,byteOffset+8+nodesByteSize,numNodes),this._pos=numNodes*4,this.minX=this._boxes[this._pos-4],this.minY=this._boxes[this._pos-3],this.maxX=this._boxes[this._pos-2],this.maxY=this._boxes[this._pos-1];else{let data2=this.data=new ArrayBufferType(8+nodesByteSize+numNodes*this.IndexArrayType.BYTES_PER_ELEMENT);this._boxes=new ArrayType(data2,8,numNodes*4),this._indices=new this.IndexArrayType(data2,8+nodesByteSize,numNodes),this._pos=0,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,new Uint8Array(data2,0,2).set([251,(VERSION<<4)+arrayTypeIndex]),new Uint16Array(data2,2,1)[0]=nodeSize,new Uint32Array(data2,4,1)[0]=numItems}this._queue=new FlatQueue}add(minX,minY,maxX=minX,maxY=minY){let index=this._pos>>2,boxes=this._boxes;return this._indices[index]=index,boxes[this._pos++]=minX,boxes[this._pos++]=minY,boxes[this._pos++]=maxX,boxes[this._pos++]=maxY,minX<this.minX&&(this.minX=minX),minY<this.minY&&(this.minY=minY),maxX>this.maxX&&(this.maxX=maxX),maxY>this.maxY&&(this.maxY=maxY),index}finish(){if(this._pos>>2!==this.numItems)throw new Error(`Added ${this._pos>>2} items when expected ${this.numItems}.`);let boxes=this._boxes;if(this.numItems<=this.nodeSize){boxes[this._pos++]=this.minX,boxes[this._pos++]=this.minY,boxes[this._pos++]=this.maxX,boxes[this._pos++]=this.maxY;return}let width=this.maxX-this.minX||1,height=this.maxY-this.minY||1,hilbertValues=new Uint32Array(this.numItems),hilbertMax=65535;for(let i3=0,pos=0;i3<this.numItems;i3++){let minX=boxes[pos++],minY=boxes[pos++],maxX=boxes[pos++],maxY=boxes[pos++],x4=Math.floor(hilbertMax*((minX+maxX)/2-this.minX)/width),y4=Math.floor(hilbertMax*((minY+maxY)/2-this.minY)/height);hilbertValues[i3]=hilbert(x4,y4)}sort(hilbertValues,boxes,this._indices,0,this.numItems-1,this.nodeSize);for(let i3=0,pos=0;i3<this._levelBounds.length-1;i3++){let end=this._levelBounds[i3];for(;pos<end;){let nodeIndex=pos,nodeMinX=boxes[pos++],nodeMinY=boxes[pos++],nodeMaxX=boxes[pos++],nodeMaxY=boxes[pos++];for(let j4=1;j4<this.nodeSize&&pos<end;j4++)nodeMinX=Math.min(nodeMinX,boxes[pos++]),nodeMinY=Math.min(nodeMinY,boxes[pos++]),nodeMaxX=Math.max(nodeMaxX,boxes[pos++]),nodeMaxY=Math.max(nodeMaxY,boxes[pos++]);this._indices[this._pos>>2]=nodeIndex,boxes[this._pos++]=nodeMinX,boxes[this._pos++]=nodeMinY,boxes[this._pos++]=nodeMaxX,boxes[this._pos++]=nodeMaxY}}}search(minX,minY,maxX,maxY,filterFn){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let nodeIndex=this._boxes.length-4,queue=[],results=[];for(;nodeIndex!==void 0;){let end=Math.min(nodeIndex+this.nodeSize*4,upperBound(nodeIndex,this._levelBounds));for(let pos=nodeIndex;pos<end;pos+=4){let x02=this._boxes[pos];if(maxX<x02)continue;let y02=this._boxes[pos+1];if(maxY<y02)continue;let x12=this._boxes[pos+2];if(minX>x12)continue;let y12=this._boxes[pos+3];if(minY>y12)continue;let index=this._indices[pos>>2]|0;nodeIndex>=this.numItems*4?queue.push(index):(filterFn===void 0||filterFn(index,x02,y02,x12,y12))&&results.push(index)}nodeIndex=queue.pop()}return results}neighbors(x4,y4,maxResults=1/0,maxDistance=1/0,filterFn){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let nodeIndex=this._boxes.length-4,q4=this._queue,results=[],maxDistSquared=maxDistance*maxDistance;outer:for(;nodeIndex!==void 0;){let end=Math.min(nodeIndex+this.nodeSize*4,upperBound(nodeIndex,this._levelBounds));for(let pos=nodeIndex;pos<end;pos+=4){let index=this._indices[pos>>2]|0,minX=this._boxes[pos],minY=this._boxes[pos+1],maxX=this._boxes[pos+2],maxY=this._boxes[pos+3],dx3=x4<minX?minX-x4:x4>maxX?x4-maxX:0,dy3=y4<minY?minY-y4:y4>maxY?y4-maxY:0,dist=dx3*dx3+dy3*dy3;dist>maxDistSquared||(nodeIndex>=this.numItems*4?q4.push(index<<1,dist):(filterFn===void 0||filterFn(index))&&q4.push((index<<1)+1,dist))}for(;q4.length&&q4.peek()&1;)if(q4.peekValue()>maxDistSquared||(results.push(q4.pop()>>1),results.length===maxResults))break outer;nodeIndex=q4.length?q4.pop()>>1:void 0}return q4.clear(),results}};function upperBound(value,arr){let i3=0,j4=arr.length-1;for(;i3<j4;){let m4=i3+j4>>1;arr[m4]>value?j4=m4:i3=m4+1}return arr[i3]}function sort(values,boxes,indices,left,right,nodeSize){let stack=[left,right];for(;stack.length;){let r5=stack.pop()||0,l4=stack.pop()||0;if(r5-l4<=nodeSize&&Math.floor(l4/nodeSize)>=Math.floor(r5/nodeSize))continue;let a3=values[l4],b3=values[l4+r5>>1],c4=values[r5],pivot=a3>b3!=a3>c4?a3:b3<a3!=b3<c4?b3:c4,i3=l4-1,j4=r5+1;for(;;){do i3++;while(values[i3]<pivot);do j4--;while(values[j4]>pivot);if(i3>=j4)break;swap(values,boxes,indices,i3,j4)}stack.push(l4,j4,j4+1,r5)}}function swap(values,boxes,indices,i3,j4){let temp=values[i3];values[i3]=values[j4],values[j4]=temp;let k4=4*i3,m4=4*j4,a3=boxes[k4],b3=boxes[k4+1],c4=boxes[k4+2],d4=boxes[k4+3];boxes[k4]=boxes[m4],boxes[k4+1]=boxes[m4+1],boxes[k4+2]=boxes[m4+2],boxes[k4+3]=boxes[m4+3],boxes[m4]=a3,boxes[m4+1]=b3,boxes[m4+2]=c4,boxes[m4+3]=d4;let e5=indices[i3];indices[i3]=indices[j4],indices[j4]=e5}function hilbert(x4,y4){let a3=x4^y4,b3=65535^a3,c4=65535^(x4|y4),d4=x4&(y4^65535),A4=a3|b3>>1,B4=a3>>1^a3,C4=c4>>1^b3&d4>>1^c4,D4=a3&c4>>1^d4>>1^d4;a3=A4,b3=B4,c4=C4,d4=D4,A4=a3&a3>>2^b3&b3>>2,B4=a3&b3>>2^b3&(a3^b3)>>2,C4^=a3&c4>>2^b3&d4>>2,D4^=b3&c4>>2^(a3^b3)&d4>>2,a3=A4,b3=B4,c4=C4,d4=D4,A4=a3&a3>>4^b3&b3>>4,B4=a3&b3>>4^b3&(a3^b3)>>4,C4^=a3&c4>>4^b3&d4>>4,D4^=b3&c4>>4^(a3^b3)&d4>>4,a3=A4,b3=B4,c4=C4,d4=D4,C4^=a3&c4>>8^b3&d4>>8,D4^=b3&c4>>8^(a3^b3)&d4>>8,a3=C4^C4>>1,b3=D4^D4>>1;let i02=x4^y4,i12=b3|65535^(i02|a3);return i02=(i02|i02<<8)&16711935,i02=(i02|i02<<4)&252645135,i02=(i02|i02<<2)&858993459,i02=(i02|i02<<1)&1431655765,i12=(i12|i12<<8)&16711935,i12=(i12|i12<<4)&252645135,i12=(i12|i12<<2)&858993459,i12=(i12|i12<<1)&1431655765,(i12<<1|i02)>>>0}var __create2=Object.create,__defProp3=Object.defineProperty,__getOwnPropDesc2=Object.getOwnPropertyDescriptor,__getOwnPropNames2=Object.getOwnPropertyNames,__getProtoOf2=Object.getPrototypeOf,__hasOwnProp2=Object.prototype.hasOwnProperty,__commonJS2=(cb3,mod)=>function(){return mod||(0,cb3[__getOwnPropNames2(cb3)[0]])((mod={exports:{}}).exports,mod),mod.exports},__copyProps2=(to3,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames2(from))!__hasOwnProp2.call(to3,key)&&key!==except&&__defProp3(to3,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc2(from,key))||desc.enumerable});return to3},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create2(__getProtoOf2(mod)):{},__copyProps2(isNodeMode||!mod||!mod.__esModule?__defProp3(target,"default",{value:mod,enumerable:!0}):target,mod)),require_is_buffer=__commonJS2({"node_modules/is-buffer/index.js"(exports,module){"use strict";module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer=="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE=="function"&&typeof obj.slice=="function"&&isBuffer(obj.slice(0,0))}}}),require_kind_of=__commonJS2({"node_modules/kind-of/index.js"(exports,module){"use strict";var isBuffer=require_is_buffer(),toString2=Object.prototype.toString;module.exports=function(val){if(typeof val>"u")return"undefined";if(val===null)return"null";if(val===!0||val===!1||val instanceof Boolean)return"boolean";if(typeof val=="string"||val instanceof String)return"string";if(typeof val=="number"||val instanceof Number)return"number";if(typeof val=="function"||val instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(val))return"array";if(val instanceof RegExp)return"regexp";if(val instanceof Date)return"date";var type=toString2.call(val);return type==="[object RegExp]"?"regexp":type==="[object Date]"?"date":type==="[object Arguments]"?"arguments":type==="[object Error]"?"error":isBuffer(val)?"buffer":type==="[object Set]"?"set":type==="[object WeakSet]"?"weakset":type==="[object Map]"?"map":type==="[object WeakMap]"?"weakmap":type==="[object Symbol]"?"symbol":type==="[object Int8Array]"?"int8array":type==="[object Uint8Array]"?"uint8array":type==="[object Uint8ClampedArray]"?"uint8clampedarray":type==="[object Int16Array]"?"int16array":type==="[object Uint16Array]"?"uint16array":type==="[object Int32Array]"?"int32array":type==="[object Uint32Array]"?"uint32array":type==="[object Float32Array]"?"float32array":type==="[object Float64Array]"?"float64array":"object"}}}),require_rename_keys=__commonJS2({"node_modules/rename-keys/index.js"(exports,module){"use strict";(function(){"use strict";function rename2(obj,fn3){if(typeof fn3!="function")return obj;var res2={};for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(res2[fn3(key,obj[key])||key]=obj[key]);return res2}typeof module<"u"&&module.exports?module.exports=rename2:typeof define=="function"&&define.amd?define([],function(){return rename2}):window.rename=rename2})()}}),require_deep_rename_keys=__commonJS2({"node_modules/deep-rename-keys/index.js"(exports,module){"use strict";var typeOf=require_kind_of(),rename2=require_rename_keys();module.exports=function renameDeep(obj,cb3){var type=typeOf(obj);if(type!=="object"&&type!=="array")throw new Error("expected an object");var res2=[];type==="object"&&(obj=rename2(obj,cb3),res2={});for(var key in obj)if(obj.hasOwnProperty(key)){var val=obj[key];typeOf(val)==="object"||typeOf(val)==="array"?res2[key]=renameDeep(val,cb3):res2[key]=val}return res2}}}),require_eventemitter3=__commonJS2({"node_modules/eventemitter3/index.js"(exports,module){"use strict";var has=Object.prototype.hasOwnProperty,prefix="~";function Events(){}Object.create&&(Events.prototype=Object.create(null),new Events().__proto__||(prefix=!1));function EE3(fn3,context,once){this.fn=fn3,this.context=context,this.once=once||!1}function EventEmitter(){this._events=new Events,this._eventsCount=0}EventEmitter.prototype.eventNames=function(){var names=[],events,name;if(this._eventsCount===0)return names;for(name in events=this._events)has.call(events,name)&&names.push(prefix?name.slice(1):name);return Object.getOwnPropertySymbols?names.concat(Object.getOwnPropertySymbols(events)):names},EventEmitter.prototype.listeners=function(event,exists){var evt=prefix?prefix+event:event,available=this._events[evt];if(exists)return!!available;if(!available)return[];if(available.fn)return[available.fn];for(var i3=0,l4=available.length,ee3=new Array(l4);i3<l4;i3++)ee3[i3]=available[i3].fn;return ee3},EventEmitter.prototype.emit=function(event,a12,a22,a3,a4,a52){var evt=prefix?prefix+event:event;if(!this._events[evt])return!1;var listeners=this._events[evt],len=arguments.length,args,i3;if(listeners.fn){switch(listeners.once&&this.removeListener(event,listeners.fn,void 0,!0),len){case 1:return listeners.fn.call(listeners.context),!0;case 2:return listeners.fn.call(listeners.context,a12),!0;case 3:return listeners.fn.call(listeners.context,a12,a22),!0;case 4:return listeners.fn.call(listeners.context,a12,a22,a3),!0;case 5:return listeners.fn.call(listeners.context,a12,a22,a3,a4),!0;case 6:return listeners.fn.call(listeners.context,a12,a22,a3,a4,a52),!0}for(i3=1,args=new Array(len-1);i3<len;i3++)args[i3-1]=arguments[i3];listeners.fn.apply(listeners.context,args)}else{var length22=listeners.length,j4;for(i3=0;i3<length22;i3++)switch(listeners[i3].once&&this.removeListener(event,listeners[i3].fn,void 0,!0),len){case 1:listeners[i3].fn.call(listeners[i3].context);break;case 2:listeners[i3].fn.call(listeners[i3].context,a12);break;case 3:listeners[i3].fn.call(listeners[i3].context,a12,a22);break;case 4:listeners[i3].fn.call(listeners[i3].context,a12,a22,a3);break;default:if(!args)for(j4=1,args=new Array(len-1);j4<len;j4++)args[j4-1]=arguments[j4];listeners[i3].fn.apply(listeners[i3].context,args)}}return!0},EventEmitter.prototype.on=function(event,fn3,context){var listener=new EE3(fn3,context||this),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.once=function(event,fn3,context){var listener=new EE3(fn3,context||this,!0),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.removeListener=function(event,fn3,context,once){var evt=prefix?prefix+event:event;if(!this._events[evt])return this;if(!fn3)return--this._eventsCount===0?this._events=new Events:delete this._events[evt],this;var listeners=this._events[evt];if(listeners.fn)listeners.fn===fn3&&(!once||listeners.once)&&(!context||listeners.context===context)&&(--this._eventsCount===0?this._events=new Events:delete this._events[evt]);else{for(var i3=0,events=[],length22=listeners.length;i3<length22;i3++)(listeners[i3].fn!==fn3||once&&!listeners[i3].once||context&&listeners[i3].context!==context)&&events.push(listeners[i3]);events.length?this._events[evt]=events.length===1?events[0]:events:--this._eventsCount===0?this._events=new Events:delete this._events[evt]}return this},EventEmitter.prototype.removeAllListeners=function(event){var evt;return event?(evt=prefix?prefix+event:event,this._events[evt]&&(--this._eventsCount===0?this._events=new Events:delete this._events[evt])):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prototype.setMaxListeners=function(){return this},EventEmitter.prefixed=prefix,EventEmitter.EventEmitter=EventEmitter,typeof module<"u"&&(module.exports=EventEmitter)}}),require_lexer=__commonJS2({"node_modules/xml-lexer/dist/lexer.js"(exports,module){"use strict";function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}var EventEmitter=require_eventemitter3(),noop=function(){},State2={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},Action={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},Type={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},charToAction={" ":Action.space," ":Action.space,"\n":Action.space,"\r":Action.space,"<":Action.lt,">":Action.gt,'"':Action.quote,"'":Action.quote,"=":Action.equal,"/":Action.slash},getAction=function(char){return charToAction[char]||Action.char},create=function(options){var _State$data,_State$tagBegin,_State$tagName,_State$tagEnd,_State$attributeNameS,_State$attributeName,_State$attributeNameE,_State$attributeValue,_State$attributeValue2,_lexer$stateMachine;options=Object.assign({debug:!1},options);var lexer=new EventEmitter,state2=State2.data,data="",tagName="",attrName="",attrValue="",isClosing="",openingQuote="",emit=function(type,value){if(!(tagName[0]==="?"||tagName[0]==="!")){var event={type,value};options.debug&&console.log("emit:",event),lexer.emit("data",event)}};lexer.stateMachine=(_lexer$stateMachine={},_defineProperty(_lexer$stateMachine,State2.data,(_State$data={},_defineProperty(_State$data,Action.lt,function(){data.trim()&&emit(Type.text,data),tagName="",isClosing=!1,state2=State2.tagBegin}),_defineProperty(_State$data,Action.char,function(char){data+=char}),_State$data)),_defineProperty(_lexer$stateMachine,State2.cdata,_defineProperty({},Action.char,function(char){data+=char,data.substr(-3)==="]]>"&&(emit(Type.text,data.slice(0,-3)),data="",state2=State2.data)})),_defineProperty(_lexer$stateMachine,State2.tagBegin,(_State$tagBegin={},_defineProperty(_State$tagBegin,Action.space,noop),_defineProperty(_State$tagBegin,Action.char,function(char){tagName=char,state2=State2.tagName}),_defineProperty(_State$tagBegin,Action.slash,function(){tagName="",isClosing=!0}),_State$tagBegin)),_defineProperty(_lexer$stateMachine,State2.tagName,(_State$tagName={},_defineProperty(_State$tagName,Action.space,function(){isClosing?state2=State2.tagEnd:(state2=State2.attributeNameStart,emit(Type.openTag,tagName))}),_defineProperty(_State$tagName,Action.gt,function(){emit(isClosing?Type.closeTag:Type.openTag,tagName),data="",state2=State2.data}),_defineProperty(_State$tagName,Action.slash,function(){state2=State2.tagEnd,emit(Type.openTag,tagName)}),_defineProperty(_State$tagName,Action.char,function(char){tagName+=char,tagName==="![CDATA["&&(state2=State2.cdata,data="",tagName="")}),_State$tagName)),_defineProperty(_lexer$stateMachine,State2.tagEnd,(_State$tagEnd={},_defineProperty(_State$tagEnd,Action.gt,function(){emit(Type.closeTag,tagName),data="",state2=State2.data}),_defineProperty(_State$tagEnd,Action.char,noop),_State$tagEnd)),_defineProperty(_lexer$stateMachine,State2.attributeNameStart,(_State$attributeNameS={},_defineProperty(_State$attributeNameS,Action.char,function(char){attrName=char,state2=State2.attributeName}),_defineProperty(_State$attributeNameS,Action.gt,function(){data="",state2=State2.data}),_defineProperty(_State$attributeNameS,Action.space,noop),_defineProperty(_State$attributeNameS,Action.slash,function(){isClosing=!0,state2=State2.tagEnd}),_State$attributeNameS)),_defineProperty(_lexer$stateMachine,State2.attributeName,(_State$attributeName={},_defineProperty(_State$attributeName,Action.space,function(){state2=State2.attributeNameEnd}),_defineProperty(_State$attributeName,Action.equal,function(){emit(Type.attributeName,attrName),state2=State2.attributeValueBegin}),_defineProperty(_State$attributeName,Action.gt,function(){attrValue="",emit(Type.attributeName,attrName),emit(Type.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeName,Action.slash,function(){isClosing=!0,attrValue="",emit(Type.attributeName,attrName),emit(Type.attributeValue,attrValue),state2=State2.tagEnd}),_defineProperty(_State$attributeName,Action.char,function(char){attrName+=char}),_State$attributeName)),_defineProperty(_lexer$stateMachine,State2.attributeNameEnd,(_State$attributeNameE={},_defineProperty(_State$attributeNameE,Action.space,noop),_defineProperty(_State$attributeNameE,Action.equal,function(){emit(Type.attributeName,attrName),state2=State2.attributeValueBegin}),_defineProperty(_State$attributeNameE,Action.gt,function(){attrValue="",emit(Type.attributeName,attrName),emit(Type.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeNameE,Action.char,function(char){attrValue="",emit(Type.attributeName,attrName),emit(Type.attributeValue,attrValue),attrName=char,state2=State2.attributeName}),_State$attributeNameE)),_defineProperty(_lexer$stateMachine,State2.attributeValueBegin,(_State$attributeValue={},_defineProperty(_State$attributeValue,Action.space,noop),_defineProperty(_State$attributeValue,Action.quote,function(char){openingQuote=char,attrValue="",state2=State2.attributeValue}),_defineProperty(_State$attributeValue,Action.gt,function(){attrValue="",emit(Type.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeValue,Action.char,function(char){openingQuote="",attrValue=char,state2=State2.attributeValue}),_State$attributeValue)),_defineProperty(_lexer$stateMachine,State2.attributeValue,(_State$attributeValue2={},_defineProperty(_State$attributeValue2,Action.space,function(char){openingQuote?attrValue+=char:(emit(Type.attributeValue,attrValue),state2=State2.attributeNameStart)}),_defineProperty(_State$attributeValue2,Action.quote,function(char){openingQuote===char?(emit(Type.attributeValue,attrValue),state2=State2.attributeNameStart):attrValue+=char}),_defineProperty(_State$attributeValue2,Action.gt,function(char){openingQuote?attrValue+=char:(emit(Type.attributeValue,attrValue),data="",state2=State2.data)}),_defineProperty(_State$attributeValue2,Action.slash,function(char){openingQuote?attrValue+=char:(emit(Type.attributeValue,attrValue),isClosing=!0,state2=State2.tagEnd)}),_defineProperty(_State$attributeValue2,Action.char,function(char){attrValue+=char}),_State$attributeValue2)),_lexer$stateMachine);var step=function(char){options.debug&&console.log(state2,char);var actions=lexer.stateMachine[state2],action=actions[getAction(char)]||actions[Action.error]||actions[Action.char];action(char)};return lexer.write=function(str){for(var len=str.length,i3=0;i3<len;i3++)step(str[i3])},lexer};module.exports={State:State2,Action,Type,create}}}),require_reader=__commonJS2({"node_modules/xml-reader/dist/reader.js"(exports,module){"use strict";var EventEmitter=require_eventemitter3(),Lexer=require_lexer(),Type=Lexer.Type,NodeType={element:"element",text:"text"},createNode=function(params){return Object.assign({name:"",type:NodeType.element,value:"",parent:null,attributes:{},children:[]},params)},create=function(options){options=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},options);var lexer=void 0,rootNode=void 0,current3=void 0,attrName=void 0,reader=new EventEmitter,handleLexerData=function(data){switch(data.type){case Type.openTag:if(current3===null)current3=rootNode,current3.name=data.value;else{var node=createNode({name:data.value,parent:current3});current3.children.push(node),current3=node}break;case Type.closeTag:var parent=current3.parent;if(options.parentNodes||(current3.parent=null),current3.name!==data.value)break;options.stream&&parent===rootNode&&(rootNode.children=[],current3.parent=null),(!options.emitTopLevelOnly||parent===rootNode)&&(reader.emit(options.tagPrefix+current3.name,current3),reader.emit("tag",current3.name,current3)),current3===rootNode&&(lexer.removeAllListeners("data"),reader.emit(options.doneEvent,current3),rootNode=null),current3=parent;break;case Type.text:current3&¤t3.children.push(createNode({type:NodeType.text,value:data.value,parent:options.parentNodes?current3:null}));break;case Type.attributeName:attrName=data.value,current3.attributes[attrName]="";break;case Type.attributeValue:current3.attributes[attrName]=data.value;break}};return reader.reset=function(){lexer=Lexer.create({debug:options.debug}),lexer.on("data",handleLexerData),rootNode=createNode(),current3=null,attrName="",reader.parse=lexer.write},reader.reset(),reader},parseSync2=function(xml,options){options=Object.assign({},options,{stream:!1,tagPrefix:":"});var reader=create(options),res2=void 0;return reader.on("done",function(ast){res2=ast}),reader.parse(xml),res2};module.exports={parseSync:parseSync2,create,NodeType}}});function computeGridToAffineTransform(params){let{originX,originY,rows,cols,cellSizeMm,width,height}=params,a3,c4;cols>1?(a3=width/((cols-1)*cellSizeMm),c4=originX*(1-a3)-.5*cellSizeMm*a3):(a3=1,c4=originX+width/2-(originX+.5*cellSizeMm));let e5,f3;return rows>1?(e5=height/((rows-1)*cellSizeMm),f3=originY*(1-e5)-.5*cellSizeMm*e5):(e5=1,f3=originY+height/2-(originY+.5*cellSizeMm)),{a:a3,b:0,c:c4,d:0,e:e5,f:f3}}function applyAffineTransformToPoint(t52,p4){return{x:t52.a*p4.x+t52.b*p4.y+t52.c,y:t52.d*p4.x+t52.e*p4.y+t52.f}}var{cos:cos3,sin:sin3,PI:PI3}=Math,{tan:tan3}=Math,import_deep_rename_keys=__toESM2(require_deep_rename_keys()),import_xml_reader=__toESM2(require_reader());var BaseSolver=class{constructor(){__publicField(this,"MAX_ITERATIONS",1e5);__publicField(this,"solved",!1);__publicField(this,"failed",!1);__publicField(this,"iterations",0);__publicField(this,"progress",0);__publicField(this,"error",null);__publicField(this,"activeSubSolver");__publicField(this,"failedSubSolvers");__publicField(this,"timeToSolve");__publicField(this,"stats",{});__publicField(this,"_setupDone",!1)}getSolverName(){return this.constructor.name}setup(){this._setupDone||(this._setup(),this._setupDone=!0)}_setup(){}step(){if(this._setupDone||this.setup(),!this.solved&&!this.failed){this.iterations++;try{this._step()}catch(e5){throw this.error=`${this.getSolverName()} error: ${e5}`,this.failed=!0,e5}!this.solved&&this.iterations>=this.MAX_ITERATIONS&&this.tryFinalAcceptance(),!this.solved&&this.iterations>=this.MAX_ITERATIONS&&(this.error=`${this.getSolverName()} ran out of iterations`,this.failed=!0),"computeProgress"in this&&(this.progress=this.computeProgress())}}_step(){}getConstructorParams(){throw new Error("getConstructorParams not implemented")}getOutput(){return null}solve(){let startTime=Date.now();for(;!this.solved&&!this.failed;)this.step();let endTime=Date.now();this.timeToSolve=endTime-startTime}visualize(){return{lines:[],points:[],rects:[],circles:[]}}tryFinalAcceptance(){}preview(){return{lines:[],points:[],rects:[],circles:[]}}};function clamp5(value,min,max){return Math.max(min,Math.min(max,value))}function computeMaxIterationsByNodeSizeAndConnectionCount(input2){let states=input2.planeSize*input2.layers,connectionCount=input2.connectionCount,connectionFactor=Math.sqrt(connectionCount),requestedMaxIterations=Math.max(1,input2.maxIterations),baseComputedMaxIterations=clamp5(Math.round(states*(8+1.2*connectionFactor)),15e4,12e6),computedMaxIters=clamp5(Math.round(baseComputedMaxIterations*input2.effort),15e4,12e6),minIterationBudgetIters=clamp5(Math.round(requestedMaxIterations*.2),15e4,2e6),maxIterationsIters=Math.max(1,Math.min(requestedMaxIterations,Math.max(minIterationBudgetIters,computedMaxIters))),baseSearchBudgetIters=clamp5(Math.round(states*(10+.8*connectionFactor)*input2.effort),5e4,4e6);return{maxIterationsIters,baseSearchBudgetIters}}function rippedContains(r5,id2){for(let cur=r5;cur;cur=cur.prev)if(cur.id===id2)return!0;return!1}var MinHeap=class{constructor(){__publicField(this,"f",[]);__publicField(this,"seq",[]);__publicField(this,"id",[]);__publicField(this,"n",0)}push(f3,seq,id2){let i3=this.n++;for(this.f[i3]=f3,this.seq[i3]=seq,this.id[i3]=id2;i3>0;){let p4=i3-1>>1;if(this.less(p4,i3))break;this.swap(i3,p4),i3=p4}}pop(){let out=this.id[0];return this.n--,this.n>0&&(this.f[0]=this.f[this.n],this.seq[0]=this.seq[this.n],this.id[0]=this.id[this.n],this.siftDown(0)),out}get size(){return this.n}clear(){this.n=0}siftDown(i3){for(;;){let l4=i3*2+1,r5=l4+1;if(l4>=this.n)return;let m4=l4;if(r5<this.n&&!this.less(l4,r5)&&(m4=r5),this.less(i3,m4))return;this.swap(i3,m4),i3=m4}}less(i3,j4){let fi3=this.f[i3],fj=this.f[j4];return fi3!==fj?fi3<fj:this.seq[i3]<this.seq[j4]}swap(i3,j4){let tmpF=this.f[i3];this.f[i3]=this.f[j4],this.f[j4]=tmpF;let tmpS=this.seq[i3];this.seq[i3]=this.seq[j4],this.seq[j4]=tmpS;let tmpI=this.id[i3];this.id[i3]=this.id[j4],this.id[j4]=tmpI}};function toRootNetName(connectionName,rootConnectionName){return rootConnectionName??connectionName.replace(/_mst\d+$/,"")}var DIRS_DR=[-1,-1,-1,0,0,1,1,1],DIRS_DC=[-1,0,1,-1,1,-1,0,1],HighDensitySolverA01=class extends BaseSolver{constructor(props){super();__publicField(this,"nodeWithPortPoints");__publicField(this,"cellSizeMm");__publicField(this,"viaDiameter");__publicField(this,"MAX_RIPS");__publicField(this,"maxCellCount");__publicField(this,"traceThickness");__publicField(this,"traceMargin");__publicField(this,"viaMinDistFromBorder");__publicField(this,"showPenaltyMap");__publicField(this,"showUsedCellMap");__publicField(this,"effort");__publicField(this,"stepMultiplier");__publicField(this,"hyperParameters");__publicField(this,"initialPenaltyFn");__publicField(this,"rows");__publicField(this,"cols");__publicField(this,"layers");__publicField(this,"gridOrigin");__publicField(this,"gridToBoundsTransform");__publicField(this,"availableZ");__publicField(this,"zToLayer");__publicField(this,"layerToZ");__publicField(this,"connNameToId");__publicField(this,"connIdToName");__publicField(this,"connIdToRootNet");__publicField(this,"overlapFriendlyRootNets");__publicField(this,"planeSize");__publicField(this,"usedCellsFlat");__publicField(this,"portOwnerFlat");__publicField(this,"usedDiagFlat");__publicField(this,"penalty2d");__publicField(this,"visitedStamp");__publicField(this,"sharedCrossRootPortCells");__publicField(this,"stamp",0);__publicField(this,"viaOffsetsDr");__publicField(this,"viaOffsetsDc");__publicField(this,"viaOffsetsLen");__publicField(this,"minViaRow");__publicField(this,"maxViaRow");__publicField(this,"minViaCol");__publicField(this,"maxViaCol");__publicField(this,"usedIndicesByConn");__publicField(this,"usedDiagIndicesByConn");__publicField(this,"unsolvedSegs");__publicField(this,"solvedRoutes");__publicField(this,"activeConnSeg",null);__publicField(this,"activeConnId",-1);__publicField(this,"crossLayerSearch",!1);__publicField(this,"nodePool");__publicField(this,"heap");__publicField(this,"seqCounter",0);__publicField(this,"_viaOccs",[]);__publicField(this,"ripCount");__publicField(this,"totalRipEvents",0);__publicField(this,"searchIterations",0);__publicField(this,"consecutiveSkips",0);__publicField(this,"penaltyCap");__publicField(this,"baseSearchBudgetIters");__publicField(this,"_moveCost",0);__publicField(this,"_moveRipped",null);this.nodeWithPortPoints=props.nodeWithPortPoints,this.cellSizeMm=props.cellSizeMm,this.viaDiameter=props.viaDiameter,this.maxCellCount=props.maxCellCount,this.traceThickness=props.traceThickness??.1,this.traceMargin=props.traceMargin??.15,this.viaMinDistFromBorder=props.viaMinDistFromBorder??.15,this.showPenaltyMap=props.showPenaltyMap??!1,this.showUsedCellMap=props.showUsedCellMap??!1,this.effort=props.effort??1,this.stepMultiplier=Math.max(1,Math.floor(props.stepMultiplier??1)),this.hyperParameters={shuffleSeed:0,ripCost:10,ripTracePenalty:.5,ripViaPenalty:.75,viaBaseCost:.1,greedyMultiplier:1.5,...props.hyperParameters},this.MAX_ITERATIONS=1e8,this.MAX_RIPS=200,this.initialPenaltyFn=props.initialPenaltyFn}get unsolvedConnections(){return this.unsolvedSegs}get solvedConnectionsMap(){return this.solvedRoutes}get activeConnection(){if(!this.activeConnSeg)return null;let s3=this.activeConnSeg;return{connectionName:this.connIdToName[s3.connId]??"",start:{row:s3.startRow,col:s3.startCol,z:s3.startZ,x:0,y:0},end:{row:s3.endRow,col:s3.endCol,z:s3.endZ,x:0,y:0}}}get openSet(){return{length:this.heap?.size??0}}get gridStats(){return{cells:this.planeSize||0,layers:this.layers||0,states:(this.planeSize||0)*(this.layers||0)}}getConstructorParams(){return[{nodeWithPortPoints:this.nodeWithPortPoints,cellSizeMm:this.cellSizeMm,viaDiameter:this.viaDiameter,maxCellCount:this.maxCellCount,stepMultiplier:this.stepMultiplier,traceThickness:this.traceThickness,traceMargin:this.traceMargin,viaMinDistFromBorder:this.viaMinDistFromBorder,showPenaltyMap:this.showPenaltyMap,showUsedCellMap:this.showUsedCellMap,effort:this.effort,hyperParameters:this.hyperParameters,initialPenaltyFn:this.initialPenaltyFn}]}_setup(){let{nodeWithPortPoints,cellSizeMm}=this,{width,height,center:center2}=nodeWithPortPoints;this.availableZ=nodeWithPortPoints.availableZ??[...new Set(nodeWithPortPoints.portPoints.map(pp3=>pp3.z))].sort((a3,b3)=>a3-b3),this.rows=Math.floor(height/cellSizeMm),this.cols=Math.floor(width/cellSizeMm),this.layers=this.availableZ.length,this.planeSize=this.rows*this.cols;let totalCells=this.layers*this.planeSize;if(this.maxCellCount!==void 0&&totalCells>this.maxCellCount){this.error=`Cell count ${totalCells} exceeds maxCellCount ${this.maxCellCount}`,this.failed=!0;return}let totalDiags=this.layers*Math.max(0,this.rows-1)*Math.max(0,this.cols-1)*2;this.zToLayer=new Map,this.layerToZ=new Map;for(let i3=0;i3<this.availableZ.length;i3++){let z4=this.availableZ[i3];this.zToLayer.set(z4,i3),this.layerToZ.set(i3,z4)}if(this.gridOrigin={x:center2.x-width/2,y:center2.y-height/2},this.gridToBoundsTransform=computeGridToAffineTransform({originX:this.gridOrigin.x,originY:this.gridOrigin.y,rows:this.rows,cols:this.cols,cellSizeMm,width,height}),this.connNameToId=new Map,this.connIdToName=[],this.connIdToRootNet=[],this.overlapFriendlyRootNets=new Set,this.penalty2d=new Float64Array(this.planeSize),this.initialPenaltyFn)for(let row=0;row<this.rows;row++){let rowBase=row*this.cols;for(let col=0;col<this.cols;col++){let x4=this.gridOrigin.x+(col+.5)*cellSizeMm,y4=this.gridOrigin.y+(row+.5)*cellSizeMm,px3=(col+.5)/this.cols,py3=(row+.5)/this.rows;this.penalty2d[rowBase+col]=this.initialPenaltyFn({x:x4,y:y4,px:px3,py:py3,row,col})}}this.usedCellsFlat=new Int32Array(totalCells).fill(-1),this.portOwnerFlat=new Int32Array(totalCells).fill(-1),this.usedDiagFlat=new Int32Array(totalDiags).fill(-1),this.visitedStamp=new Uint32Array(totalCells),this.stamp=0;let viaRadiusCells=Math.ceil(this.viaDiameter/2/cellSizeMm),r22=viaRadiusCells*viaRadiusCells,drList=[],dcList=[];for(let dr3=-viaRadiusCells;dr3<=viaRadiusCells;dr3++)for(let dc3=-viaRadiusCells;dc3<=viaRadiusCells;dc3++)dr3*dr3+dc3*dc3<=r22&&(drList.push(dr3),dcList.push(dc3));if(this.viaOffsetsLen=drList.length,this.viaOffsetsDr=new Int32Array(drList),this.viaOffsetsDc=new Int32Array(dcList),this.viaMinDistFromBorder>0){let borderCells=Math.ceil(this.viaMinDistFromBorder/cellSizeMm);this.minViaRow=borderCells,this.maxViaRow=this.rows-1-borderCells,this.minViaCol=borderCells,this.maxViaCol=this.cols-1-borderCells}else this.minViaRow=0,this.maxViaRow=this.rows-1,this.minViaCol=0,this.maxViaCol=this.cols-1;this.unsolvedSegs=this.buildConnectionSegs(),this.sharedCrossRootPortCells=new Set;let rootByPortFlat=new Map;for(let pp3 of this.nodeWithPortPoints.portPoints){let connId=this.connNameToId.get(pp3.connectionName);if(connId===void 0)continue;let cell=this.pointToCell(pp3),flatIdx=(cell.z*this.rows+cell.row)*this.cols+cell.col,rootNet=this.connIdToRootNet[connId],existingRoot=rootByPortFlat.get(flatIdx);existingRoot===void 0?rootByPortFlat.set(flatIdx,rootNet):existingRoot!==rootNet&&this.sharedCrossRootPortCells.add(flatIdx);let existing=this.portOwnerFlat[flatIdx];existing===-1||existing===connId?this.portOwnerFlat[flatIdx]=connId:this.portOwnerFlat[flatIdx]=-2}this.solvedRoutes=new Map,this.usedIndicesByConn=[],this.usedDiagIndicesByConn=[],this.ripCount=[],this.consecutiveSkips=0,this.penaltyCap=this.hyperParameters.ripCost*.5,this.shuffleConnections();let budget=computeMaxIterationsByNodeSizeAndConnectionCount({planeSize:this.planeSize,layers:this.layers,connectionCount:this.unsolvedSegs.length,effort:this.effort,maxIterations:this.MAX_ITERATIONS});this.baseSearchBudgetIters=budget.baseSearchBudgetIters,this.MAX_ITERATIONS=budget.maxIterationsIters,this.activeConnSeg=null,this.activeConnId=-1,this.nodePool=[],this.heap=new MinHeap,this.seqCounter=0}_step(){for(let i3=0;i3<this.stepMultiplier;i3++){if(this.solved||this.failed)return;this.stepOnce()}}stepOnce(){if(!this.activeConnSeg){if(this.unsolvedSegs.length===0){this.solved=!0;return}let next2=this.unsolvedSegs.shift();this.activeConnSeg=next2,this.activeConnId=next2.connId,this.crossLayerSearch=next2.startZ!==next2.endZ,this.nodePool=[],this.heap.clear(),this.seqCounter=0,this.searchIterations=0,this.nextStamp();let f3=this.computeH(next2.startZ,next2.startRow,next2.startCol,next2.endZ,next2.endRow,next2.endCol)*this.hyperParameters.greedyMultiplier;this.nodePool.push({z:next2.startZ,row:next2.startRow,col:next2.startCol,g:0,f:f3,parentIdx:-1,ripped:null}),this.heap.push(f3,this.seqCounter++,0);return}this.searchIterations++;let connRips=this.ripCount[this.activeConnId]??0,budget=Math.round(this.baseSearchBudgetIters*(1+Math.min(connRips,10)*.25));if(this.searchIterations>budget){let pen=this.penalty2d;for(let i3=0;i3<pen.length;i3++)pen[i3]=pen[i3]*.9;this.unsolvedSegs.push(this.activeConnSeg),this.activeConnSeg=null,this.activeConnId=-1,this.heap.clear(),this.nodePool=[],this.consecutiveSkips++,this.consecutiveSkips>=this.unsolvedSegs.length*3&&(this.error=`Convergence failure: ${this.unsolvedSegs.length} connections stuck`,this.failed=!0);return}if(this.heap.size===0){this.error=`No path found for ${this.connIdToName[this.activeConnId]}`,this.failed=!0;return}let nodeIdx=this.heap.pop(),node=this.nodePool[nodeIdx],{z:z4,row,col,g:g6,ripped}=node,cellIdx=(z4*this.rows+row)*this.cols+col;if(this.visitedStamp[cellIdx]===this.stamp)return;this.visitedStamp[cellIdx]=this.stamp;let seg=this.activeConnSeg;if(z4===seg.endZ&&row===seg.endRow&&col===seg.endCol){this.finalizeRoute(nodeIdx),this.activeConnSeg=null,this.activeConnId=-1;return}let endZ=seg.endZ,endRow=seg.endRow,endCol=seg.endCol,activeConn=this.activeConnId,rows=this.rows,cols=this.cols,cellSizeMm=this.cellSizeMm,visited=this.visitedStamp,stamp=this.stamp;for(let d4=0;d4<8;d4++){let nr3=row+DIRS_DR[d4],nc3=col+DIRS_DC[d4];if(nr3<0||nr3>=rows||nc3<0||nc3>=cols)continue;let nIdx=(z4*rows+nr3)*cols+nc3;if(visited[nIdx]===stamp||(this.computeMoveCostAndRips(activeConn,z4,row,col,z4,nr3,nc3,ripped),this._moveCost<0))continue;let g22=g6+this._moveCost,f22=g22+this.computeH(z4,nr3,nc3,endZ,endRow,endCol)*this.hyperParameters.greedyMultiplier,newNodeIdx=this.nodePool.length;this.nodePool.push({z:z4,row:nr3,col:nc3,g:g22,f:f22,parentIdx:nodeIdx,ripped:this._moveRipped}),this.heap.push(f22,this.seqCounter++,newNodeIdx)}if(row>=this.minViaRow&&row<=this.maxViaRow&&col>=this.minViaCol&&col<=this.maxViaCol)for(let nz2=0;nz2<this.layers;nz2++){if(nz2===z4)continue;let nIdx=(nz2*rows+row)*cols+col;if(visited[nIdx]===stamp||(this.computeMoveCostAndRips(activeConn,z4,row,col,nz2,row,col,ripped),this._moveCost<0))continue;let g22=g6+this._moveCost,f22=g22+this.computeH(nz2,row,col,endZ,endRow,endCol)*this.hyperParameters.greedyMultiplier,newNodeIdx=this.nodePool.length;this.nodePool.push({z:nz2,row,col,g:g22,f:f22,parentIdx:nodeIdx,ripped:this._moveRipped}),this.heap.push(f22,this.seqCounter++,newNodeIdx)}}computeMoveCostAndRips(activeConn,fromZ,fromRow,fromCol,toZ,toRow,toCol,ripped){let cost=0,r5=ripped,cols=this.cols;if(fromZ!==toZ){cost+=this.hyperParameters.viaBaseCost,cost+=Math.min(this.penalty2d[toRow*cols+toCol],this.penaltyCap);let toFlatIdx=(toZ*this.rows+toRow)*cols+toCol,fixedOwner=this.portOwnerFlat[toFlatIdx],allowFixedOverlap=this.connIdToRootNet[fixedOwner]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]),seg=this.activeConnSeg,isSegEnd=!!seg&&toZ===seg.endZ&&toRow===seg.endRow&&toCol===seg.endCol;if(fixedOwner>=0&&fixedOwner!==activeConn&&!allowFixedOverlap&&!isSegEnd){this._moveCost=-1,this._moveRipped=r5;return}this.fillViaOccupants(toRow,toCol,activeConn);let occs=this._viaOccs;for(let i3=0;i3<occs.length;i3++){let occ=occs[i3];rippedContains(r5,occ)||(cost+=this.hyperParameters.ripCost,r5={id:occ,prev:r5}),cost+=this.hyperParameters.ripViaPenalty}}else{let dr3=fromRow>toRow?fromRow-toRow:toRow-fromRow,dc3=fromCol>toCol?fromCol-toCol:toCol-fromCol;cost+=(dr3+dc3>1?Math.SQRT2:1)*this.cellSizeMm,cost+=Math.min(this.penalty2d[toRow*cols+toCol],this.penaltyCap);let flatIdx=(toZ*this.rows+toRow)*cols+toCol,fixedOwner=this.portOwnerFlat[flatIdx],allowFixedOverlap=this.connIdToRootNet[fixedOwner]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]),seg=this.activeConnSeg,isSegEnd=!!seg&&toZ===seg.endZ&&toRow===seg.endRow&&toCol===seg.endCol;if(fixedOwner>=0&&fixedOwner!==activeConn&&!allowFixedOverlap&&!isSegEnd){this._moveCost=-1,this._moveRipped=r5;return}let occ=this.usedCellsFlat[flatIdx],allowSameRootOverlap=this.connIdToRootNet[occ]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]);if(occ!==-1&&occ!==activeConn&&!allowSameRootOverlap&&(rippedContains(r5,occ)||(cost+=this.hyperParameters.ripCost,r5={id:occ,prev:r5}),cost+=this.hyperParameters.ripTracePenalty),dr3===1&&dc3===1){let sqRow=fromRow<toRow?fromRow:toRow,sqCol=fromCol<toCol?fromCol:toCol,crossingSlot=(fromRow<toRow&&fromCol<toCol||fromRow>toRow&&fromCol>toCol?0:1)^1,sqCols=this.cols-1,diagBase=((toZ*(this.rows-1)+sqRow)*sqCols+sqCol)*2,crossingOcc=this.usedDiagFlat[diagBase+crossingSlot],allowCrossingOverlap=this.connIdToRootNet[crossingOcc]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]);if(crossingOcc!==-1&&crossingOcc!==activeConn&&!allowCrossingOverlap){this._moveCost=-1,this._moveRipped=r5;return}}}this._moveCost=cost,this._moveRipped=r5}fillViaOccupants(row,col,activeConn){let occs=this._viaOccs;occs.length=0;let rows=this.rows,cols=this.cols,offDr=this.viaOffsetsDr,offDc=this.viaOffsetsDc,offLen=this.viaOffsetsLen,used=this.usedCellsFlat;for(let z4=0;z4<this.layers;z4++){let zBase=z4*this.planeSize;for(let i3=0;i3<offLen;i3++){let r5=row+offDr[i3],c4=col+offDc[i3];if(r5<0||c4<0||r5>=rows||c4>=cols)continue;let occ=used[zBase+r5*cols+c4];if(occ===-1||occ===activeConn||this.connIdToRootNet[occ]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]))continue;let seen=!1;for(let j4=0;j4<occs.length;j4++)if(occs[j4]===occ){seen=!0;break}seen||occs.push(occ)}}}shouldSkipFixedPortHalo(flatIdx,connId){let fixedOwner=this.portOwnerFlat[flatIdx];return fixedOwner===connId?!1:fixedOwner===-2?!0:fixedOwner<0?!1:!(this.connIdToRootNet[fixedOwner]===this.connIdToRootNet[connId]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[connId]))}nextStamp(){this.stamp=this.stamp+1>>>0,this.stamp===0&&(this.visitedStamp.fill(0),this.stamp=1)}computeH(z4,row,col,toZ,toRow,toCol){let dr3=Math.abs(row-toRow),dc3=Math.abs(col-toCol),manhattan=dr3+dc3;if(z4===toZ)return manhattan*this.cellSizeMm;if(!this.crossLayerSearch)return manhattan*this.cellSizeMm+this.hyperParameters.viaBaseCost;let vr1=Math.max(this.minViaRow,Math.min(this.maxViaRow,row)),vc1=Math.max(this.minViaCol,Math.min(this.maxViaCol,col)),vr22=Math.max(this.minViaRow,Math.min(this.maxViaRow,toRow)),vc22=Math.max(this.minViaCol,Math.min(this.maxViaCol,toCol)),via1=Math.abs(row-vr1)+Math.abs(col-vc1)+Math.abs(vr1-toRow)+Math.abs(vc1-toCol),via2=Math.abs(row-vr22)+Math.abs(col-vc22)+Math.abs(vr22-toRow)+Math.abs(vc22-toCol);return Math.max(Math.min(via1,via2),manhattan)*this.cellSizeMm+this.hyperParameters.viaBaseCost}internConn(name,rootNetName){let existing=this.connNameToId.get(name);if(existing!==void 0)return existing;let id2=this.connIdToName.length;return this.connIdToName.push(name),this.connIdToRootNet.push(toRootNetName(name,rootNetName)),this.connNameToId.set(name,id2),id2}buildConnectionSegs(){let byName=new Map;for(let pp3 of this.nodeWithPortPoints.portPoints){let name=pp3.connectionName;byName.has(name)||byName.set(name,{points:[],rootConnectionName:pp3.rootConnectionName}),byName.get(name).points.push(pp3)}let segs=[],seenSegmentKeys=new Set;for(let[name,conn]of byName){let pts=conn.points;if(pts.length<2)continue;let connId=this.internConn(name,conn.rootConnectionName);for(let i3=0;i3<pts.length-1;i3++){let s3=this.pointToCell(pts[i3]),e5=this.pointToCell(pts[i3+1]),endpointA=`${s3.z}:${s3.row}:${s3.col}`,endpointB=`${e5.z}:${e5.row}:${e5.col}`,orderedEndpoints=endpointA<endpointB?`${endpointA}|${endpointB}`:`${endpointB}|${endpointA}`,netName=conn.rootConnectionName??name,segKey=`${netName}|${orderedEndpoints}`;if(seenSegmentKeys.has(segKey)){this.overlapFriendlyRootNets.add(netName);continue}seenSegmentKeys.add(segKey),segs.push({connId,startZ:s3.z,startRow:s3.row,startCol:s3.col,startPoint:pts[i3],endZ:e5.z,endRow:e5.row,endCol:e5.col,endPoint:pts[i3+1]})}}return segs}pointToCell(pt3){let col=Math.max(0,Math.min(this.cols-1,Math.round((pt3.x-this.gridOrigin.x)/this.cellSizeMm-.5))),row=Math.max(0,Math.min(this.rows-1,Math.round((pt3.y-this.gridOrigin.y)/this.cellSizeMm-.5)));return{z:this.zToLayer.get(pt3.z)??0,row,col}}shuffleConnections(){let arr=this.unsolvedSegs,s3=this.hyperParameters.shuffleSeed,rng=()=>(s3=s3*1664525+1013904223&4294967295,(s3>>>0)/4294967295);for(let i3=arr.length-1;i3>0;i3--){let j4=Math.floor(rng()*(i3+1)),tmp=arr[i3];arr[i3]=arr[j4],arr[j4]=tmp}}finalizeRoute(goalNodeIdx){this.consecutiveSkips=Math.max(0,this.consecutiveSkips-1);let cells=[],idx=goalNodeIdx;for(;idx>=0;){let n4=this.nodePool[idx];cells.push({z:n4.z,row:n4.row,col:n4.col}),idx=n4.parentIdx}for(cells.reverse();cells.length>1;){let first=cells[0],firstFlat=(first.z*this.rows+first.row)*this.cols+first.col;if(!this.sharedCrossRootPortCells.has(firstFlat))break;cells.shift()}for(;cells.length>1;){let last=cells[cells.length-1],lastFlat=(last.z*this.rows+last.row)*this.cols+last.col;if(!this.sharedCrossRootPortCells.has(lastFlat))break;cells.pop()}let viaCells=[];for(let i3=1;i3<cells.length;i3++)cells[i3].z!==cells[i3-1].z&&viaCells.push({row:cells[i3].row,col:cells[i3].col});let firstCell=cells[0],lastCell=cells[cells.length-1],connId=this.activeConnId,goalNode=this.nodePool[goalNodeIdx],rippedIds=[];for(let cur=goalNode.ripped;cur;cur=cur.prev)rippedIds.push(cur.id);for(let i3=0;i3<rippedIds.length;i3++)if(this.ripTrace(rippedIds[i3]),this.failed)return;let marginCells=Math.ceil(this.traceMargin/this.cellSizeMm),indices=[],rows=this.rows,cols=this.cols,used=this.usedCellsFlat;for(let ci3=0;ci3<cells.length;ci3++){let cell=cells[ci3];for(let dr3=-marginCells;dr3<=marginCells;dr3++)for(let dc3=-marginCells;dc3<=marginCells;dc3++){let r5=cell.row+dr3,c4=cell.col+dc3;if(r5<0||r5>=rows||c4<0||c4>=cols)continue;let flatIdx=(cell.z*rows+r5)*cols+c4;if((r5!==cell.row||c4!==cell.col)&&this.shouldSkipFixedPortHalo(flatIdx,connId))continue;let existing=used[flatIdx],allowSameRootOverlap=this.connIdToRootNet[existing]===this.connIdToRootNet[connId]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[connId]);existing!==-1&&existing!==connId&&!allowSameRootOverlap||(used[flatIdx]=connId,indices.push(flatIdx))}}let displacedByVias=[],offDr=this.viaOffsetsDr,offDc=this.viaOffsetsDc,offLen=this.viaOffsetsLen;for(let vi3=0;vi3<viaCells.length;vi3++){let via=viaCells[vi3];for(let z4=0;z4<this.layers;z4++){let zBase=z4*this.planeSize;for(let oi3=0;oi3<offLen;oi3++){let r5=via.row+offDr[oi3],c4=via.col+offDc[oi3];if(r5<0||r5>=rows||c4<0||c4>=cols)continue;let flatIdx=zBase+r5*cols+c4;if((r5!==via.row||c4!==via.col)&&this.shouldSkipFixedPortHalo(flatIdx,connId))continue;let existing=used[flatIdx],allowSameRootOverlap=this.connIdToRootNet[existing]===this.connIdToRootNet[connId]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[connId]);if(existing!==-1&&existing!==connId&&!allowSameRootOverlap){let seen=!1;for(let k4=0;k4<displacedByVias.length;k4++)if(displacedByVias[k4]===existing){seen=!0;break}seen||displacedByVias.push(existing)}used[flatIdx]=connId,indices.push(flatIdx)}}}let diagIndices=[],sqCols=this.cols-1;for(let i3=1;i3<cells.length;i3++){let prev=cells[i3-1],curr=cells[i3];if(prev.z!==curr.z)continue;let dr3=prev.row>curr.row?prev.row-curr.row:curr.row-prev.row,dc3=prev.col>curr.col?prev.col-curr.col:curr.col-prev.col;if(dr3!==1||dc3!==1)continue;let sqRow=prev.row<curr.row?prev.row:curr.row,sqCol=prev.col<curr.col?prev.col:curr.col,diagSlot=prev.row<curr.row&&prev.col<curr.col||prev.row>curr.row&&prev.col>curr.col?0:1,crossingSlot=diagSlot^1,diagBase=((prev.z*(this.rows-1)+sqRow)*sqCols+sqCol)*2,crossingIdx=diagBase+crossingSlot,crossingOcc=this.usedDiagFlat[crossingIdx],allowCrossingOverlap=this.connIdToRootNet[crossingOcc]===this.connIdToRootNet[connId]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[connId]);if(crossingOcc!==-1&&crossingOcc!==connId&&!allowCrossingOverlap)continue;let diagIdx=diagBase+diagSlot;this.usedDiagFlat[diagIdx]=connId,diagIndices.push(diagIdx)}for(;this.usedIndicesByConn.length<=connId;)this.usedIndicesByConn.push([]);let usedIndices=this.usedIndicesByConn[connId]??[];for(usedIndices.push(...indices),this.usedIndicesByConn[connId]=usedIndices;this.usedDiagIndicesByConn.length<=connId;)this.usedDiagIndicesByConn.push([]);let usedDiagIndices=this.usedDiagIndicesByConn[connId]??[];usedDiagIndices.push(...diagIndices),this.usedDiagIndicesByConn[connId]=usedDiagIndices;let solvedRoutes=this.solvedRoutes.get(connId)??[];solvedRoutes.push({connId,startZ:firstCell.z,startRow:firstCell.row,startCol:firstCell.col,startPoint:this.activeConnSeg.startPoint,endZ:lastCell.z,endRow:lastCell.row,endCol:lastCell.col,endPoint:this.activeConnSeg.endPoint,cells,viaCells}),this.solvedRoutes.set(connId,solvedRoutes);for(let i3=0;i3<displacedByVias.length;i3++)if(this.ripTrace(displacedByVias[i3]),this.failed)return;if(rippedIds.length>0||displacedByVias.length>0){let pen=this.penalty2d,cap2=this.penaltyCap;if(this.totalRipEvents>50)for(let i3=0;i3<pen.length;i3++)pen[i3]=pen[i3]*.99;else for(let i3=0;i3<pen.length;i3++)pen[i3]>cap2&&(pen[i3]=pen[i3]*.5)}}ripTrace(connId){for(;this.ripCount.length<=connId;)this.ripCount.push(0);if(this.ripCount[connId]++,this.totalRipEvents++,this.totalRipEvents>=this.MAX_RIPS){this.error=`Convergence failure: exceeded MAX_RIPS ${this.MAX_RIPS}`,this.failed=!0;return}let routes=this.solvedRoutes.get(connId)??[];if(routes.length>0){let cols=this.cols;for(let route of routes){for(let i3=0;i3<route.cells.length;i3++){let cell=route.cells[i3],cellIdx=cell.row*cols+cell.col;this.penalty2d[cellIdx]=this.penalty2d[cellIdx]+this.hyperParameters.ripTracePenalty}for(let i3=0;i3<route.viaCells.length;i3++){let via=route.viaCells[i3],viaIdx=via.row*cols+via.col;this.penalty2d[viaIdx]=this.penalty2d[viaIdx]+this.hyperParameters.ripViaPenalty}}}let indices=this.usedIndicesByConn[connId];if(indices){let used=this.usedCellsFlat;for(let i3=0;i3<indices.length;i3++){let flatIdx=indices[i3];used[flatIdx]===connId&&(used[flatIdx]=-1)}this.usedIndicesByConn[connId]=[]}let diagIndices=this.usedDiagIndicesByConn[connId];if(diagIndices){let usedDiag=this.usedDiagFlat;for(let i3=0;i3<diagIndices.length;i3++){let flatIdx=diagIndices[i3];usedDiag[flatIdx]===connId&&(usedDiag[flatIdx]=-1)}this.usedDiagIndicesByConn[connId]=[]}if(routes.length>0){this.solvedRoutes.delete(connId);for(let route of routes)this.unsolvedSegs.push({connId,startZ:route.startZ,startRow:route.startRow,startCol:route.startCol,startPoint:route.startPoint,endZ:route.endZ,endRow:route.endRow,endCol:route.endCol,endPoint:route.endPoint})}}visualize(){let LAYER_COLORS2=["red","blue","orange","green"],points=[],lines=[],circles=[],rects=[],{width,height,center:center2}=this.nodeWithPortPoints;rects.push({center:{x:center2.x,y:center2.y},width,height,stroke:"gray"});let vt3=this.gridToBoundsTransform;if(this.showPenaltyMap&&this.penalty2d){let maxPenalty=0;for(let i3=0;i3<this.penalty2d.length;i3++)this.penalty2d[i3]>maxPenalty&&(maxPenalty=this.penalty2d[i3]);if(maxPenalty>0)for(let row=0;row<this.rows;row++)for(let col=0;col<this.cols;col++){let p4=this.penalty2d[row*this.cols+col];if(p4<=0)continue;let alpha=Math.min(.6,p4/maxPenalty*.6),tc3=applyAffineTransformToPoint(vt3,{x:this.gridOrigin.x+(col+.5)*this.cellSizeMm,y:this.gridOrigin.y+(row+.5)*this.cellSizeMm});rects.push({center:tc3,width:this.cellSizeMm*vt3.a,height:this.cellSizeMm*vt3.e,fill:`rgba(255,165,0,${alpha.toFixed(3)})`})}}if(this.showUsedCellMap&&this.usedCellsFlat)for(let z4=0;z4<this.layers;z4++)for(let row=0;row<this.rows;row++)for(let col=0;col<this.cols;col++){if(this.usedCellsFlat[(z4*this.rows+row)*this.cols+col]===-1)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.gridOrigin.x+(col+.5)*this.cellSizeMm,y:this.gridOrigin.y+(row+.5)*this.cellSizeMm});rects.push({center:tc3,width:this.cellSizeMm*vt3.a,height:this.cellSizeMm*vt3.e,fill:"rgba(0,0,255,0.5)"})}for(let pp3 of this.nodeWithPortPoints.portPoints)points.push({x:pp3.x,y:pp3.y,color:LAYER_COLORS2[pp3.z]??"gray",label:pp3.connectionName});let TRACE_COLORS3=["rgba(255,0,0,0.75)","rgba(0,0,255,0.75)","rgba(255,165,0,0.75)","rgba(0,128,0,0.75)"],transformedRoutes=this.getOutput();for(let route of transformedRoutes){if(route.route.length<2)continue;let segStart=0;for(let i3=1;i3<route.route.length;i3++){let prev=route.route[i3-1];route.route[i3].z!==prev.z&&(i3-segStart>=2&&lines.push({points:route.route.slice(segStart,i3).map(p4=>({x:p4.x,y:p4.y})),strokeColor:TRACE_COLORS3[prev.z]??"rgba(128,128,128,0.75)",strokeWidth:this.traceThickness}),segStart=i3)}if(route.route.length-segStart>=2){let lastZ=route.route[segStart].z;lines.push({points:route.route.slice(segStart).map(p4=>({x:p4.x,y:p4.y})),strokeColor:TRACE_COLORS3[lastZ]??"rgba(128,128,128,0.75)",strokeWidth:this.traceThickness})}}for(let route of transformedRoutes)for(let via of route.vias)circles.push({center:{x:via.x,y:via.y},radius:this.viaDiameter/2,fill:"rgba(0,0,0,0.3)",stroke:"black"});if(this.activeConnSeg&&this.visitedStamp){let currentStamp=this.stamp;for(let z4=0;z4<this.layers;z4++)for(let row=0;row<this.rows;row++)for(let col=0;col<this.cols;col++){if(this.visitedStamp[(z4*this.rows+row)*this.cols+col]!==currentStamp)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.gridOrigin.x+(col+.5)*this.cellSizeMm,y:this.gridOrigin.y+(row+.5)*this.cellSizeMm});points.push({x:tc3.x,y:tc3.y,color:"rgba(0,0,255,0.2)"})}}return{points,lines,circles,rects,coordinateSystem:"cartesian",title:`HighDensityA01 [${this.solvedRoutes?.size??0} solved, ${this.unsolvedSegs?.length??0} remaining]`}}getOutput(){let t52=this.gridToBoundsTransform,result=[];for(let[connId,routes]of this.solvedRoutes??[]){let connName=this.connIdToName[connId];for(let route of routes){let points=route.cells.map(cell=>{let rawX=this.gridOrigin.x+(cell.col+.5)*this.cellSizeMm,rawY=this.gridOrigin.y+(cell.row+.5)*this.cellSizeMm,tp3=applyAffineTransformToPoint(t52,{x:rawX,y:rawY});return{x:tp3.x,y:tp3.y,z:this.layerToZ.get(cell.z)??cell.z}});points.length>0&&(points[0]={...route.startPoint},points.length>1&&(points[points.length-1]={...route.endPoint})),result.push({connectionName:connName,rootConnectionName:this.connIdToRootNet[connId],traceThickness:this.traceThickness,viaDiameter:this.viaDiameter,route:points,vias:route.viaCells.map(via=>{let rawX=this.gridOrigin.x+(via.col+.5)*this.cellSizeMm,rawY=this.gridOrigin.y+(via.row+.5)*this.cellSizeMm;return applyAffineTransformToPoint(t52,{x:rawX,y:rawY})})})}}return result}};var REGION_LEFT=0,REGION_TOP=1,REGION_RIGHT=2,REGION_BOTTOM=3,REGION_MIDDLE=4,REGION_NAMES=["left","top","right","bottom","middle"],TypedMinHeap2=class{constructor(){__publicField(this,"f",new Float64Array(1024));__publicField(this,"seq",new Uint32Array(1024));__publicField(this,"id",new Int32Array(1024));__publicField(this,"n",0)}push(f3,seq,id2){this.ensureCapacity(this.n+1);let i3=this.n++;for(this.f[i3]=f3,this.seq[i3]=seq,this.id[i3]=id2;i3>0;){let p4=i3-1>>1;if(this.less(p4,i3))break;this.swap(i3,p4),i3=p4}}pop(){let out=this.id[0];return this.n--,this.n>0&&(this.f[0]=this.f[this.n],this.seq[0]=this.seq[this.n],this.id[0]=this.id[this.n],this.siftDown(0)),out}get size(){return this.n}clear(){this.n=0}ensureCapacity(size3){if(size3<=this.f.length)return;let next2=this.f.length;for(;next2<size3;)next2*=2;let nf3=new Float64Array(next2);nf3.set(this.f),this.f=nf3;let ns3=new Uint32Array(next2);ns3.set(this.seq),this.seq=ns3;let ni3=new Int32Array(next2);ni3.set(this.id),this.id=ni3}siftDown(i3){for(;;){let l4=i3*2+1,r5=l4+1;if(l4>=this.n)return;let m4=l4;if(r5<this.n&&!this.less(l4,r5)&&(m4=r5),this.less(i3,m4))return;this.swap(i3,m4),i3=m4}}less(i3,j4){let fi3=this.f[i3],fj=this.f[j4];return fi3!==fj?fi3<fj:this.seq[i3]<this.seq[j4]}swap(i3,j4){let tf3=this.f[i3];this.f[i3]=this.f[j4],this.f[j4]=tf3;let ts3=this.seq[i3];this.seq[i3]=this.seq[j4],this.seq[j4]=ts3;let ti3=this.id[i3];this.id[i3]=this.id[j4],this.id[j4]=ti3}},TypedNodePool2=class{constructor(){__publicField(this,"z",new Int32Array(1024));__publicField(this,"cellId",new Int32Array(1024));__publicField(this,"g",new Float64Array(1024));__publicField(this,"parent",new Int32Array(1024));__publicField(this,"ripHead",new Int32Array(1024).fill(-1));__publicField(this,"ripCount",new Int32Array(1024));__publicField(this,"length",0)}clear(){this.length=0}push(z4,cellId,g6,parent,ripHead,ripCount){this.ensureCapacity(this.length+1);let idx=this.length++;return this.z[idx]=z4,this.cellId[idx]=cellId,this.g[idx]=g6,this.parent[idx]=parent,this.ripHead[idx]=ripHead,this.ripCount[idx]=ripCount,idx}ensureCapacity(size3){if(size3<=this.z.length)return;let next2=this.z.length;for(;next2<size3;)next2*=2;let nz2=new Int32Array(next2);nz2.set(this.z),this.z=nz2;let nc3=new Int32Array(next2);nc3.set(this.cellId),this.cellId=nc3;let ng3=new Float64Array(next2);ng3.set(this.g),this.g=ng3;let np2=new Int32Array(next2);np2.set(this.parent),this.parent=np2;let nr3=new Int32Array(next2);nr3.fill(-1),nr3.set(this.ripHead.subarray(0,this.length)),this.ripHead=nr3;let nrc=new Int32Array(next2);nrc.set(this.ripCount.subarray(0,this.length)),this.ripCount=nrc}},TypedRipChain2=class{constructor(){__publicField(this,"connId",new Int32Array(1024));__publicField(this,"prev",new Int32Array(1024).fill(-1));__publicField(this,"length",0)}clear(){this.length=0}append(prevHead,connId){this.ensureCapacity(this.length+1);let idx=this.length++;return this.connId[idx]=connId,this.prev[idx]=prevHead,idx}contains(head,connId){for(let cur=head;cur>=0;cur=this.prev[cur])if(this.connId[cur]===connId)return!0;return!1}collect(head,out){out.length=0;for(let cur=head;cur>=0;cur=this.prev[cur])out.push(this.connId[cur])}ensureCapacity(size3){if(size3<=this.connId.length)return;let next2=this.connId.length;for(;next2<size3;)next2*=2;let nc3=new Int32Array(next2);nc3.set(this.connId),this.connId=nc3;let np2=new Int32Array(next2);np2.fill(-1),np2.set(this.prev.subarray(0,this.length)),this.prev=np2}};function toRootNetName3(connectionName,rootConnectionName){return rootConnectionName??connectionName.replace(/_mst\d+$/,"")}function clamp32(value,min,max){return Math.max(min,Math.min(max,value))}function pushUnique2(arr,value){for(let i3=0;i3<arr.length;i3++)if(arr[i3]===value)return;arr.push(value)}function pushUniqueNeighbor2(arr,edge){for(let i3=0;i3<arr.length;i3++)if(arr[i3].cellId===edge.cellId)return;arr.push(edge)}function circleIntersectsRect2(cx3,cy3,r5,minX,minY,maxX,maxY){let qx3=clamp32(cx3,minX,maxX),qy3=clamp32(cy3,minY,maxY),dx3=cx3-qx3,dy3=cy3-qy3;return dx3*dx3+dy3*dy3<=r5*r5}var HighDensitySolverA03=class extends BaseSolver{constructor(props){super();__publicField(this,"nodeWithPortPoints");__publicField(this,"highResolutionCellSize");__publicField(this,"highResolutionCellThickness");__publicField(this,"lowResolutionCellSize");__publicField(this,"viaDiameter");__publicField(this,"MAX_RIPS");__publicField(this,"maxCellCount");__publicField(this,"traceThickness");__publicField(this,"traceMargin");__publicField(this,"viaMinDistFromBorder");__publicField(this,"showPenaltyMap");__publicField(this,"showUsedCellMap");__publicField(this,"effort");__publicField(this,"stepMultiplier");__publicField(this,"hyperParameters");__publicField(this,"initialPenaltyFn");__publicField(this,"boundsMinX");__publicField(this,"boundsMaxX");__publicField(this,"boundsMinY");__publicField(this,"boundsMaxY");__publicField(this,"gridToBoundsTransform");__publicField(this,"availableZ");__publicField(this,"zToLayer");__publicField(this,"layerToZ");__publicField(this,"layers");__publicField(this,"fineRows");__publicField(this,"fineCols");__publicField(this,"lowScale");__publicField(this,"bandRows");__publicField(this,"bandCols");__publicField(this,"regions");__publicField(this,"planeSize");__publicField(this,"cellCenterX");__publicField(this,"cellCenterY");__publicField(this,"cellMinX");__publicField(this,"cellMinY");__publicField(this,"cellMaxX");__publicField(this,"cellMaxY");__publicField(this,"cellWidth");__publicField(this,"cellHeight");__publicField(this,"cellRegion");__publicField(this,"cellRow");__publicField(this,"cellCol");__publicField(this,"viaAllowed");__publicField(this,"neighborOffset");__publicField(this,"neighborIds");__publicField(this,"neighborCosts");__publicField(this,"usedCellsFlat");__publicField(this,"sharedCellsFlat");__publicField(this,"portOwnerFlat");__publicField(this,"penalty2d");__publicField(this,"ripStateBuckets");__publicField(this,"visitedStamp");__publicField(this,"bestGStamp");__publicField(this,"bestGValue");__publicField(this,"visitedFlatStamp");__publicField(this,"sharedCrossRootPortFlat");__publicField(this,"stamp",0);__publicField(this,"connNameToId");__publicField(this,"connIdToName");__publicField(this,"connIdToRootNet");__publicField(this,"overlapFriendlyRootNets");__publicField(this,"usedIndicesByConn");__publicField(this,"unsolvedSegs");__publicField(this,"solvedRoutes");__publicField(this,"activeConnSeg",null);__publicField(this,"activeConnId",-1);__publicField(this,"nodePool");__publicField(this,"heap");__publicField(this,"ripChain");__publicField(this,"seqCounter",0);__publicField(this,"_viaOccs",[]);__publicField(this,"_cellOccs",[]);__publicField(this,"_rippedIds",[]);__publicField(this,"ripCount");__publicField(this,"totalRipEvents",0);__publicField(this,"searchIterations",0);__publicField(this,"consecutiveSkips",0);__publicField(this,"penaltyCap");__publicField(this,"baseSearchBudgetIters");__publicField(this,"_moveCost",0);__publicField(this,"_moveRippedHead",-1);__publicField(this,"_moveRipCount",0);__publicField(this,"traceKeepoutRadius");__publicField(this,"viaKeepoutRadius");this.nodeWithPortPoints=props.nodeWithPortPoints,this.highResolutionCellSize=props.highResolutionCellSize??.1,this.highResolutionCellThickness=Math.max(1,Math.floor(props.highResolutionCellThickness??8)),this.lowResolutionCellSize=props.lowResolutionCellSize??.4,this.viaDiameter=props.viaDiameter,this.maxCellCount=props.maxCellCount,this.traceThickness=props.traceThickness??.1,this.traceMargin=props.traceMargin??.15,this.viaMinDistFromBorder=props.viaMinDistFromBorder??.15,this.showPenaltyMap=props.showPenaltyMap??!1,this.showUsedCellMap=props.showUsedCellMap??!1,this.effort=props.effort??1,this.stepMultiplier=Math.max(1,Math.floor(props.stepMultiplier??1)),this.hyperParameters={shuffleSeed:0,ripCost:8,ripTracePenalty:.5,ripViaPenalty:.75,viaBaseCost:.1,greedyMultiplier:1.5,...props.hyperParameters},this.MAX_ITERATIONS=1e8,this.MAX_RIPS=200,this.initialPenaltyFn=props.initialPenaltyFn}get unsolvedConnections(){return this.unsolvedSegs}get solvedConnectionsMap(){let map=new Map;for(let connId=0;connId<this.solvedRoutes.length;connId++){let route=this.solvedRoutes[connId];route&&map.set(connId,route)}return map}get activeConnection(){if(!this.activeConnSeg)return null;let startCellId=this.activeConnSeg.startCellId,endCellId=this.activeConnSeg.endCellId;return{connectionName:this.connIdToName[this.activeConnSeg.connId]??"",start:{cellId:startCellId,region:REGION_NAMES[this.cellRegion[startCellId]],row:this.cellRow[startCellId],col:this.cellCol[startCellId],x:this.cellCenterX[startCellId],y:this.cellCenterY[startCellId],z:this.activeConnSeg.startZ},end:{cellId:endCellId,region:REGION_NAMES[this.cellRegion[endCellId]],row:this.cellRow[endCellId],col:this.cellCol[endCellId],x:this.cellCenterX[endCellId],y:this.cellCenterY[endCellId],z:this.activeConnSeg.endZ}}}get openSet(){return{length:this.heap?.size??0}}get gridStats(){return{cells:this.planeSize||0,layers:this.layers||0,states:(this.planeSize||0)*(this.layers||0),ripStateBuckets:this.ripStateBuckets||0,neighborEdges:this.neighborIds?.length??0,regionCounts:this.regions?Object.fromEntries(this.regions.map(region=>[region.name,region.rows*region.cols])):{}}}getConstructorParams(){return[{nodeWithPortPoints:this.nodeWithPortPoints,highResolutionCellSize:this.highResolutionCellSize,highResolutionCellThickness:this.highResolutionCellThickness,lowResolutionCellSize:this.lowResolutionCellSize,viaDiameter:this.viaDiameter,maxCellCount:this.maxCellCount,stepMultiplier:this.stepMultiplier,traceThickness:this.traceThickness,traceMargin:this.traceMargin,viaMinDistFromBorder:this.viaMinDistFromBorder,showPenaltyMap:this.showPenaltyMap,showUsedCellMap:this.showUsedCellMap,effort:this.effort,hyperParameters:this.hyperParameters,initialPenaltyFn:this.initialPenaltyFn}]}_setup(){let{nodeWithPortPoints}=this,{width,height,center:center2}=nodeWithPortPoints,rawScale=this.lowResolutionCellSize/this.highResolutionCellSize,roundedScale=Math.round(rawScale);if(!Number.isFinite(rawScale)||rawScale<=0||Math.abs(rawScale-roundedScale)>1e-9){this.error="lowResolutionCellSize must be a positive integer multiple of highResolutionCellSize",this.failed=!0;return}this.lowScale=Math.max(1,roundedScale),this.availableZ=nodeWithPortPoints.availableZ??[...new Set(nodeWithPortPoints.portPoints.map(pp3=>pp3.z))].sort((a3,b3)=>a3-b3),this.layers=this.availableZ.length,this.zToLayer=new Map,this.layerToZ=new Map;for(let i3=0;i3<this.availableZ.length;i3++){let z4=this.availableZ[i3];this.zToLayer.set(z4,i3),this.layerToZ.set(i3,z4)}this.boundsMinX=center2.x-width/2,this.boundsMaxX=center2.x+width/2,this.boundsMinY=center2.y-height/2,this.boundsMaxY=center2.y+height/2,this.traceKeepoutRadius=this.traceMargin+this.traceThickness/2,this.viaKeepoutRadius=this.viaDiameter/2+this.traceKeepoutRadius,this.buildFiveRegionGrid(width,height),this.gridToBoundsTransform=this.computeGridToBoundsTransform();let totalCells=this.layers*this.planeSize;if(this.maxCellCount!==void 0&&totalCells>this.maxCellCount){this.error=`Cell count ${totalCells} exceeds maxCellCount ${this.maxCellCount}`,this.failed=!0;return}this.connNameToId=new Map,this.connIdToName=[],this.connIdToRootNet=[],this.overlapFriendlyRootNets=new Set,this.unsolvedSegs=this.buildConnectionSegs(),this.penalty2d=new Float64Array(this.planeSize);let widthInv=width>0?1/width:0,heightInv=height>0?1/height:0;for(let cellId=0;cellId<this.planeSize;cellId++){let penalty=0;this.initialPenaltyFn&&(penalty+=this.initialPenaltyFn({x:this.cellCenterX[cellId],y:this.cellCenterY[cellId],px:(this.cellCenterX[cellId]-this.boundsMinX)*widthInv,py:(this.cellCenterY[cellId]-this.boundsMinY)*heightInv,cellId,region:REGION_NAMES[this.cellRegion[cellId]],row:this.cellRow[cellId],col:this.cellCol[cellId]})),this.penalty2d[cellId]=penalty}this.usedCellsFlat=new Int32Array(totalCells).fill(-1),this.sharedCellsFlat=Array.from({length:totalCells},()=>{}),this.portOwnerFlat=new Int32Array(totalCells).fill(-1),this.sharedCrossRootPortFlat=new Uint8Array(totalCells),this.ripStateBuckets=1;let searchStateCount=totalCells;this.visitedStamp=new Uint32Array(searchStateCount),this.bestGStamp=new Uint32Array(searchStateCount),this.bestGValue=new Float64Array(searchStateCount),this.visitedFlatStamp=new Uint32Array(totalCells),this.stamp=0;let rootByPortFlat=new Map;for(let pp3 of this.nodeWithPortPoints.portPoints){let connId=this.connNameToId.get(pp3.connectionName);if(connId===void 0)continue;let cell=this.pointToCell(pp3),flatIdx=cell.z*this.planeSize+cell.cellId,rootNet=this.connIdToRootNet[connId],existingRoot=rootByPortFlat.get(flatIdx);existingRoot===void 0?rootByPortFlat.set(flatIdx,rootNet):existingRoot!==rootNet&&(this.sharedCrossRootPortFlat[flatIdx]=1);let existing=this.portOwnerFlat[flatIdx];existing===-1||existing===connId?this.portOwnerFlat[flatIdx]=connId:this.portOwnerFlat[flatIdx]=-2}this.solvedRoutes=[],this.usedIndicesByConn=[],this.ripCount=[],this.consecutiveSkips=0,this.penaltyCap=this.hyperParameters.ripCost*.5,this.shuffleConnections();let budget=computeMaxIterationsByNodeSizeAndConnectionCount({planeSize:this.planeSize,layers:this.layers,connectionCount:this.unsolvedSegs.length,effort:this.effort,maxIterations:this.MAX_ITERATIONS});this.baseSearchBudgetIters=budget.baseSearchBudgetIters,this.MAX_ITERATIONS=budget.maxIterationsIters,this.activeConnSeg=null,this.activeConnId=-1,this.nodePool=new TypedNodePool2,this.heap=new TypedMinHeap2,this.ripChain=new TypedRipChain2,this.seqCounter=0}_step(){for(let i3=0;i3<this.stepMultiplier;i3++){if(this.solved||this.failed)return;this.stepOnce()}}buildFiveRegionGrid(width,height){this.fineCols=Math.max(1,Math.ceil(width/this.highResolutionCellSize)),this.fineRows=Math.max(1,Math.ceil(height/this.highResolutionCellSize)),this.bandCols=Math.min(this.highResolutionCellThickness,Math.floor(this.fineCols/2)),this.bandRows=Math.min(this.highResolutionCellThickness,Math.floor(this.fineRows/2));let middleFineCols=Math.max(0,this.fineCols-this.bandCols*2),middleFineRows=Math.max(0,this.fineRows-this.bandRows*2),topFineCols=middleFineCols,bottomFineCols=middleFineCols;this.regions=[{id:REGION_LEFT,name:"left",fineOriginRow:0,fineOriginCol:0,fineRows:this.fineRows,fineCols:this.bandCols,cellScale:1,rows:this.fineRows,cols:this.bandCols,offset:0},{id:REGION_TOP,name:"top",fineOriginRow:0,fineOriginCol:this.bandCols,fineRows:this.bandRows,fineCols:topFineCols,cellScale:1,rows:this.bandRows,cols:topFineCols,offset:0},{id:REGION_RIGHT,name:"right",fineOriginRow:0,fineOriginCol:this.fineCols-this.bandCols,fineRows:this.fineRows,fineCols:this.bandCols,cellScale:1,rows:this.fineRows,cols:this.bandCols,offset:0},{id:REGION_BOTTOM,name:"bottom",fineOriginRow:this.fineRows-this.bandRows,fineOriginCol:this.bandCols,fineRows:this.bandRows,fineCols:bottomFineCols,cellScale:1,rows:this.bandRows,cols:bottomFineCols,offset:0},{id:REGION_MIDDLE,name:"middle",fineOriginRow:this.bandRows,fineOriginCol:this.bandCols,fineRows:middleFineRows,fineCols:middleFineCols,cellScale:this.lowScale,rows:middleFineRows>0?Math.ceil(middleFineRows/this.lowScale):0,cols:middleFineCols>0?Math.ceil(middleFineCols/this.lowScale):0,offset:0}];let offset=0;for(let i3=0;i3<this.regions.length;i3++)this.regions[i3].offset=offset,offset+=this.regions[i3].rows*this.regions[i3].cols;this.planeSize=offset,this.cellCenterX=new Float64Array(this.planeSize),this.cellCenterY=new Float64Array(this.planeSize),this.cellMinX=new Float64Array(this.planeSize),this.cellMinY=new Float64Array(this.planeSize),this.cellMaxX=new Float64Array(this.planeSize),this.cellMaxY=new Float64Array(this.planeSize),this.cellWidth=new Float64Array(this.planeSize),this.cellHeight=new Float64Array(this.planeSize),this.cellRegion=new Uint8Array(this.planeSize),this.cellRow=new Int32Array(this.planeSize),this.cellCol=new Int32Array(this.planeSize),this.viaAllowed=new Uint8Array(this.planeSize);for(let regionIdx=0;regionIdx<this.regions.length;regionIdx++){let region=this.regions[regionIdx];for(let row=0;row<region.rows;row++){let fineRow0=region.fineOriginRow+row*region.cellScale,fineRow1=Math.min(region.fineOriginRow+region.fineRows,fineRow0+region.cellScale),minY=this.boundsMinY+fineRow0*this.highResolutionCellSize,maxY=Math.min(this.boundsMaxY,this.boundsMinY+fineRow1*this.highResolutionCellSize);for(let col=0;col<region.cols;col++){let fineCol0=region.fineOriginCol+col*region.cellScale,fineCol1=Math.min(region.fineOriginCol+region.fineCols,fineCol0+region.cellScale),minX=this.boundsMinX+fineCol0*this.highResolutionCellSize,maxX=Math.min(this.boundsMaxX,this.boundsMinX+fineCol1*this.highResolutionCellSize),cellId=this.cellIdFor(region.id,row,col);this.cellCenterX[cellId]=(minX+maxX)/2,this.cellCenterY[cellId]=(minY+maxY)/2,this.cellMinX[cellId]=minX,this.cellMinY[cellId]=minY,this.cellMaxX[cellId]=maxX,this.cellMaxY[cellId]=maxY,this.cellWidth[cellId]=maxX-minX,this.cellHeight[cellId]=maxY-minY,this.cellRegion[cellId]=region.id,this.cellRow[cellId]=row,this.cellCol[cellId]=col;let minBorderDist=Math.min(this.cellCenterX[cellId]-this.boundsMinX,this.boundsMaxX-this.cellCenterX[cellId],this.cellCenterY[cellId]-this.boundsMinY,this.boundsMaxY-this.cellCenterY[cellId]);this.viaAllowed[cellId]=minBorderDist>=this.viaMinDistFromBorder?1:0}}}let neighbors=Array.from({length:this.planeSize},()=>[]),addBidirectionalEdge=(a3,b3)=>{if(a3===b3||a3<0||b3<0)return;let dx3=this.cellCenterX[a3]-this.cellCenterX[b3],dy3=this.cellCenterY[a3]-this.cellCenterY[b3],cost=Math.hypot(dx3,dy3);pushUniqueNeighbor2(neighbors[a3],{cellId:b3,cost}),pushUniqueNeighbor2(neighbors[b3],{cellId:a3,cost})};for(let regionIdx=0;regionIdx<this.regions.length;regionIdx++){let region=this.regions[regionIdx];for(let row=0;row<region.rows;row++)for(let col=0;col<region.cols;col++){let cellId=this.cellIdFor(region.id,row,col);row+1<region.rows&&addBidirectionalEdge(cellId,this.cellIdFor(region.id,row+1,col)),col+1<region.cols&&addBidirectionalEdge(cellId,this.cellIdFor(region.id,row,col+1))}}let left=this.regions[REGION_LEFT],top=this.regions[REGION_TOP],right=this.regions[REGION_RIGHT],bottom=this.regions[REGION_BOTTOM],middle=this.regions[REGION_MIDDLE],hasLeft=left.rows>0&&left.cols>0,hasTop=top.rows>0&&top.cols>0,hasRight=right.rows>0&&right.cols>0,hasBottom=bottom.rows>0&&bottom.cols>0,hasMiddle=middle.rows>0&&middle.cols>0;if(hasLeft&&hasTop)for(let globalRow=0;globalRow<this.bandRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_LEFT,globalRow,left.cols-1),this.cellIdFor(REGION_TOP,globalRow,0));if(hasTop&&hasRight)for(let globalRow=0;globalRow<this.bandRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_TOP,globalRow,top.cols-1),this.cellIdFor(REGION_RIGHT,globalRow,0));if(hasLeft&&hasBottom)for(let globalRow=this.fineRows-this.bandRows;globalRow<this.fineRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_LEFT,globalRow,left.cols-1),this.cellIdFor(REGION_BOTTOM,globalRow-(this.fineRows-this.bandRows),0));if(hasBottom&&hasRight)for(let globalRow=this.fineRows-this.bandRows;globalRow<this.fineRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_BOTTOM,globalRow-(this.fineRows-this.bandRows),bottom.cols-1),this.cellIdFor(REGION_RIGHT,globalRow,0));if(hasLeft&&hasMiddle)for(let globalRow=this.bandRows;globalRow<this.fineRows-this.bandRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_LEFT,globalRow,left.cols-1),this.cellIdFor(REGION_MIDDLE,Math.floor((globalRow-this.bandRows)/this.lowScale),0));if(hasRight&&hasMiddle)for(let globalRow=this.bandRows;globalRow<this.fineRows-this.bandRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_MIDDLE,Math.floor((globalRow-this.bandRows)/this.lowScale),middle.cols-1),this.cellIdFor(REGION_RIGHT,globalRow,0));if(hasTop&&hasMiddle)for(let globalCol=this.bandCols;globalCol<this.fineCols-this.bandCols;globalCol++)addBidirectionalEdge(this.cellIdFor(REGION_TOP,top.rows-1,globalCol-this.bandCols),this.cellIdFor(REGION_MIDDLE,0,Math.floor((globalCol-this.bandCols)/this.lowScale)));if(hasBottom&&hasMiddle)for(let globalCol=this.bandCols;globalCol<this.fineCols-this.bandCols;globalCol++)addBidirectionalEdge(this.cellIdFor(REGION_MIDDLE,middle.rows-1,Math.floor((globalCol-this.bandCols)/this.lowScale)),this.cellIdFor(REGION_BOTTOM,0,globalCol-this.bandCols));if(!hasMiddle&&!hasTop&&!hasBottom&&hasLeft&&hasRight)for(let row=0;row<Math.min(left.rows,right.rows);row++)addBidirectionalEdge(this.cellIdFor(REGION_LEFT,row,left.cols-1),this.cellIdFor(REGION_RIGHT,row,0));if(!hasMiddle&&!hasLeft&&!hasRight&&hasTop&&hasBottom)for(let col=0;col<Math.min(top.cols,bottom.cols);col++)addBidirectionalEdge(this.cellIdFor(REGION_TOP,top.rows-1,col),this.cellIdFor(REGION_BOTTOM,0,col));let flattened=this.flattenNeighborLists(neighbors);this.neighborOffset=flattened.offset,this.neighborIds=flattened.ids,this.neighborCosts=flattened.costs}cellIdFor(regionId,row,col){let region=this.regions[regionId];return region.offset+row*region.cols+col}stepOnce(){if(!this.activeConnSeg){if(this.unsolvedSegs.length===0){this.solved=!0;return}let next2=this.unsolvedSegs.shift();this.activeConnSeg=next2,this.activeConnId=next2.connId,this.nodePool.clear(),this.ripChain.clear(),this.heap.clear(),this.seqCounter=0,this.searchIterations=0,this.nextStamp();let f3=this.computeH(next2.startZ,next2.startCellId,next2.endZ,next2.endCellId)*this.hyperParameters.greedyMultiplier,startIdx=this.nodePool.push(next2.startZ,next2.startCellId,0,-1,-1,0),startFlatIdx=next2.startZ*this.planeSize+next2.startCellId,startStateIdx=this.getSearchStateIdx(startFlatIdx,0);this.bestGStamp[startStateIdx]=this.stamp,this.bestGValue[startStateIdx]=0,this.heap.push(f3,this.seqCounter++,startIdx);return}this.searchIterations++;let connRips=this.ripCount[this.activeConnId]??0,budget=Math.round(this.baseSearchBudgetIters*(1+Math.min(connRips,10)*.25));if(this.searchIterations>budget){let pen=this.penalty2d;for(let i3=0;i3<pen.length;i3++)pen[i3]=pen[i3]*.9;this.unsolvedSegs.push(this.activeConnSeg),this.activeConnSeg=null,this.activeConnId=-1,this.heap.clear(),this.nodePool.clear(),this.consecutiveSkips++,this.consecutiveSkips>=Math.max(3,this.unsolvedSegs.length*3)&&(this.error=`Convergence failure: ${this.unsolvedSegs.length} connections stuck`,this.failed=!0);return}if(this.heap.size===0){this.error=`No path found for ${this.connIdToName[this.activeConnId]}`,this.failed=!0;return}let nodeIdx=this.heap.pop(),z4=this.nodePool.z[nodeIdx],cellId=this.nodePool.cellId[nodeIdx],g6=this.nodePool.g[nodeIdx],rippedHead=this.nodePool.ripHead[nodeIdx],ripCount=this.nodePool.ripCount[nodeIdx],flatIdx=z4*this.planeSize+cellId,searchStateIdx=this.getSearchStateIdx(flatIdx,ripCount);if(this.visitedStamp[searchStateIdx]===this.stamp)return;this.visitedStamp[searchStateIdx]=this.stamp,this.visitedFlatStamp[flatIdx]=this.stamp;let seg=this.activeConnSeg;if(z4===seg.endZ&&cellId===seg.endCellId){this.finalizeRoute(nodeIdx),this.activeConnSeg=null,this.activeConnId=-1;return}let visited=this.visitedStamp,stamp=this.stamp,activeConn=this.activeConnId,endZ=seg.endZ,endCellId=seg.endCellId,neighborStart=this.neighborOffset[cellId],neighborEnd=this.neighborOffset[cellId+1];for(let i3=neighborStart;i3<neighborEnd;i3++){let neighborCellId=this.neighborIds[i3],nextFlatIdx=z4*this.planeSize+neighborCellId;if(this.computeMoveCostAndRips(activeConn,z4,neighborCellId,!1,rippedHead,ripCount,this.neighborCosts[i3]),this._moveCost<0)continue;let nextStateIdx=this.getSearchStateIdx(nextFlatIdx,this._moveRipCount);if(visited[nextStateIdx]===stamp)continue;let g22=g6+this._moveCost;if(this.bestGStamp[nextStateIdx]===stamp&&g22>=this.bestGValue[nextStateIdx])continue;this.bestGStamp[nextStateIdx]=stamp,this.bestGValue[nextStateIdx]=g22;let f22=g22+this.computeH(z4,neighborCellId,endZ,endCellId)*this.hyperParameters.greedyMultiplier,newNodeIdx=this.nodePool.push(z4,neighborCellId,g22,nodeIdx,this._moveRippedHead,this._moveRipCount);this.heap.push(f22,this.seqCounter++,newNodeIdx)}if(this.viaAllowed[cellId])for(let nz2=0;nz2<this.layers;nz2++){if(nz2===z4)continue;let nextFlatIdx=nz2*this.planeSize+cellId;if(this.computeMoveCostAndRips(activeConn,nz2,cellId,!0,rippedHead,ripCount,0),this._moveCost<0)continue;let nextStateIdx=this.getSearchStateIdx(nextFlatIdx,this._moveRipCount);if(visited[nextStateIdx]===stamp)continue;let g22=g6+this._moveCost;if(this.bestGStamp[nextStateIdx]===stamp&&g22>=this.bestGValue[nextStateIdx])continue;this.bestGStamp[nextStateIdx]=stamp,this.bestGValue[nextStateIdx]=g22;let f22=g22+this.computeH(nz2,cellId,endZ,endCellId)*this.hyperParameters.greedyMultiplier,newNodeIdx=this.nodePool.push(nz2,cellId,g22,nodeIdx,this._moveRippedHead,this._moveRipCount);this.heap.push(f22,this.seqCounter++,newNodeIdx)}}computeMoveCostAndRips(activeConn,toZ,toCellId,isVia,rippedHead,currentRipCount,lateralCost){let cost=0,head=rippedHead,ripCount=currentRipCount,toFlatIdx=toZ*this.planeSize+toCellId;if(isVia){cost+=this.hyperParameters.viaBaseCost,cost+=Math.min(this.penalty2d[toCellId],this.penaltyCap);let fixedOwner=this.portOwnerFlat[toFlatIdx],allowFixedOverlap=this.allowSharedUse(activeConn,fixedOwner),seg=this.activeConnSeg,isSegEnd=!!seg&&toZ===seg.endZ&&toCellId===seg.endCellId;if(fixedOwner>=0&&fixedOwner!==activeConn&&!allowFixedOverlap&&!isSegEnd){this._moveCost=-1,this._moveRippedHead=head;return}this.fillViaOccupants(toCellId,activeConn);let occs=this._viaOccs;for(let i3=0;i3<occs.length;i3++){let occ=occs[i3];this.ripChain.contains(head,occ)||(cost+=this.hyperParameters.ripCost,head=this.ripChain.append(head,occ),ripCount++),cost+=this.hyperParameters.ripViaPenalty}}else{cost+=lateralCost,cost+=Math.min(this.penalty2d[toCellId],this.penaltyCap);let fixedOwner=this.portOwnerFlat[toFlatIdx],allowFixedOverlap=this.allowSharedUse(activeConn,fixedOwner),seg=this.activeConnSeg,isSegEnd=!!seg&&toZ===seg.endZ&&toCellId===seg.endCellId;if(fixedOwner>=0&&fixedOwner!==activeConn&&!allowFixedOverlap&&!isSegEnd){this._moveCost=-1,this._moveRippedHead=head;return}this.fillTraceOccupants(toFlatIdx,activeConn,this._cellOccs);for(let i3=0;i3<this._cellOccs.length;i3++){let occ=this._cellOccs[i3];this.ripChain.contains(head,occ)||(cost+=this.hyperParameters.ripCost,head=this.ripChain.append(head,occ),ripCount++),cost+=this.hyperParameters.ripTracePenalty}}this._moveCost=cost,this._moveRippedHead=head,this._moveRipCount=ripCount}fillViaOccupants(cellId,activeConn){let occs=this._viaOccs;occs.length=0;let cx3=this.cellCenterX[cellId],cy3=this.cellCenterY[cellId];this.forEachCellNearCircle(cx3,cy3,this.viaKeepoutRadius,occCellId=>{if(circleIntersectsRect2(cx3,cy3,this.viaKeepoutRadius,this.cellMinX[occCellId],this.cellMinY[occCellId],this.cellMaxX[occCellId],this.cellMaxY[occCellId]))for(let z4=0;z4<this.layers;z4++)this.pushFlatOccupants(z4*this.planeSize+occCellId,activeConn,occs)})}fillTraceOccupants(flatIdx,activeConn,out){out.length=0,this.pushFlatOccupants(flatIdx,activeConn,out)}pushFlatOccupants(flatIdx,activeConn,out){let primaryOcc=this.usedCellsFlat[flatIdx];primaryOcc!==-1&&primaryOcc!==activeConn&&!this.allowSharedUse(activeConn,primaryOcc)&&pushUnique2(out,primaryOcc);let sharedOccs=this.sharedCellsFlat[flatIdx];if(sharedOccs)for(let i3=0;i3<sharedOccs.length;i3++){let occ=sharedOccs[i3];occ!==activeConn&&(this.allowSharedUse(activeConn,occ)||pushUnique2(out,occ))}}addSharedOccupant(flatIdx,connId){if(this.usedCellsFlat[flatIdx]===connId)return;let sharedOccs=this.sharedCellsFlat[flatIdx];sharedOccs||(sharedOccs=[],this.sharedCellsFlat[flatIdx]=sharedOccs),pushUnique2(sharedOccs,connId)}replaceOccupants(flatIdx,connId){this.usedCellsFlat[flatIdx]=connId,this.sharedCellsFlat[flatIdx]=void 0}removeOccupant(flatIdx,connId){let sharedOccs=this.sharedCellsFlat[flatIdx];if(this.usedCellsFlat[flatIdx]===connId){sharedOccs&&sharedOccs.length>0?(this.usedCellsFlat[flatIdx]=sharedOccs.pop(),sharedOccs.length===0&&(this.sharedCellsFlat[flatIdx]=void 0)):this.usedCellsFlat[flatIdx]=-1;return}if(!sharedOccs)return;let idx=sharedOccs.indexOf(connId);idx!==-1&&(sharedOccs.splice(idx,1),sharedOccs.length===0&&(this.sharedCellsFlat[flatIdx]=void 0))}allowSharedUse(activeConn,existingConn){return existingConn<0?!1:this.connIdToRootNet[existingConn]===this.connIdToRootNet[activeConn]}shouldSkipFixedPortHalo(flatIdx,connId){let fixedOwner=this.portOwnerFlat[flatIdx];return fixedOwner===connId?!1:fixedOwner===-2?!0:fixedOwner<0?!1:!this.allowSharedUse(connId,fixedOwner)}nextStamp(){this.stamp=this.stamp+1>>>0,this.stamp===0&&(this.visitedStamp.fill(0),this.bestGStamp.fill(0),this.visitedFlatStamp.fill(0),this.stamp=1)}getSearchStateIdx(flatIdx,ripCount){return flatIdx}computeH(z4,cellId,toZ,toCellId){let dist=Math.hypot(this.cellCenterX[cellId]-this.cellCenterX[toCellId],this.cellCenterY[cellId]-this.cellCenterY[toCellId]);return z4===toZ?dist:dist+this.hyperParameters.viaBaseCost}internConn(name,rootNetName){let existing=this.connNameToId.get(name);if(existing!==void 0)return existing;let id2=this.connIdToName.length;return this.connIdToName.push(name),this.connIdToRootNet.push(toRootNetName3(name,rootNetName)),this.connNameToId.set(name,id2),id2}buildConnectionSegs(){let byName=new Map;for(let pp3 of this.nodeWithPortPoints.portPoints){let name=pp3.connectionName;byName.has(name)||byName.set(name,{points:[],rootConnectionName:pp3.rootConnectionName}),byName.get(name).points.push(pp3)}let segs=[],seenSegmentKeys=new Set;for(let[name,conn]of byName){let pts=conn.points;if(pts.length<2)continue;let connId=this.internConn(name,conn.rootConnectionName);for(let i3=0;i3<pts.length-1;i3++){let s3=this.pointToCell(pts[i3]),e5=this.pointToCell(pts[i3+1]),endpointA=`${s3.z}:${s3.cellId}`,endpointB=`${e5.z}:${e5.cellId}`,orderedEndpoints=endpointA<endpointB?`${endpointA}|${endpointB}`:`${endpointB}|${endpointA}`,netName=conn.rootConnectionName??name,segKey=`${netName}|${orderedEndpoints}`;if(seenSegmentKeys.has(segKey)){this.overlapFriendlyRootNets.add(netName);continue}seenSegmentKeys.add(segKey),segs.push({connId,startZ:s3.z,startCellId:s3.cellId,startPoint:pts[i3],endZ:e5.z,endCellId:e5.cellId,endPoint:pts[i3+1]})}}return segs}pointToCell(pt3){let fineCol=clamp32(Math.floor((pt3.x-this.boundsMinX)/this.highResolutionCellSize),0,this.fineCols-1),fineRow=clamp32(Math.floor((pt3.y-this.boundsMinY)/this.highResolutionCellSize),0,this.fineRows-1),regionId=REGION_MIDDLE;fineCol<this.bandCols?regionId=REGION_LEFT:fineCol>=this.fineCols-this.bandCols?regionId=REGION_RIGHT:fineRow<this.bandRows?regionId=REGION_TOP:fineRow>=this.fineRows-this.bandRows&&(regionId=REGION_BOTTOM);let region=this.regions[regionId],localFineRow=fineRow-region.fineOriginRow,localFineCol=fineCol-region.fineOriginCol,row=clamp32(Math.floor(localFineRow/region.cellScale),0,Math.max(0,region.rows-1)),col=clamp32(Math.floor(localFineCol/region.cellScale),0,Math.max(0,region.cols-1));return{z:this.zToLayer.get(pt3.z)??0,cellId:this.cellIdFor(regionId,row,col)}}shuffleConnections(){let arr=this.unsolvedSegs,s3=this.hyperParameters.shuffleSeed>>>0,rng=()=>(s3=Math.imul(s3,1664525)+1013904223>>>0,s3/4294967295);for(let i3=arr.length-1;i3>0;i3--){let j4=Math.floor(rng()*(i3+1)),tmp=arr[i3];arr[i3]=arr[j4],arr[j4]=tmp}}finalizeRoute(goalNodeIdx){this.consecutiveSkips=Math.max(0,this.consecutiveSkips-1);let states=[],idx=goalNodeIdx;for(;idx>=0;){let z4=this.nodePool.z[idx],cellId=this.nodePool.cellId[idx];states.push(z4*this.planeSize+cellId),idx=this.nodePool.parent[idx]}for(states.reverse();states.length>1&&this.sharedCrossRootPortFlat[states[0]];)states.shift();for(;states.length>1&&this.sharedCrossRootPortFlat[states[states.length-1]];)states.pop();let viaCellIds=this.extractViaCellIds(states),connId=this.activeConnId;this.ripChain.collect(this.nodePool.ripHead[goalNodeIdx],this._rippedIds);for(let i3=0;i3<this._rippedIds.length;i3++)if(this.ripTrace(this._rippedIds[i3]),this.failed)return;let indices=[];for(let i3=0;i3<states.length;i3++){let state2=states[i3],z4=Math.floor(state2/this.planeSize),cellId=state2-z4*this.planeSize;this.markTraceFootprint(connId,z4,cellId,indices)}let displacedByVias=[];for(let i3=0;i3<viaCellIds.length;i3++)this.markViaFootprint(connId,viaCellIds[i3],indices,displacedByVias);for(;this.usedIndicesByConn.length<=connId;)this.usedIndicesByConn.push(void 0);for(this.usedIndicesByConn[connId]=indices;this.solvedRoutes.length<=connId;)this.solvedRoutes.push(void 0);this.solvedRoutes[connId]={connId,states:Int32Array.from(states),viaCellIds:Int32Array.from(viaCellIds),startPoint:this.activeConnSeg.startPoint,endPoint:this.activeConnSeg.endPoint};for(let i3=0;i3<displacedByVias.length;i3++)if(this.ripTrace(displacedByVias[i3]),this.failed)return;if(this._rippedIds.length>0||displacedByVias.length>0){let pen=this.penalty2d,cap2=this.penaltyCap;if(this.totalRipEvents>50)for(let i3=0;i3<pen.length;i3++)pen[i3]=pen[i3]*.99;else for(let i3=0;i3<pen.length;i3++)pen[i3]>cap2&&(pen[i3]=pen[i3]*.5)}}extractViaCellIds(states){let viaCellIds=[];for(let i3=1;i3<states.length;i3++){let prevState=states[i3-1],nextState=states[i3],prevZ=Math.floor(prevState/this.planeSize),nextZ=Math.floor(nextState/this.planeSize);prevZ!==nextZ&&viaCellIds.push(nextState-nextZ*this.planeSize)}return viaCellIds}markTraceFootprint(connId,z4,sourceCellId,indices){let cx3=this.cellCenterX[sourceCellId],cy3=this.cellCenterY[sourceCellId];this.forEachCellNearCircle(cx3,cy3,this.traceKeepoutRadius,cellId=>{if(!circleIntersectsRect2(cx3,cy3,this.traceKeepoutRadius,this.cellMinX[cellId],this.cellMinY[cellId],this.cellMaxX[cellId],this.cellMaxY[cellId]))return;let flatIdx=z4*this.planeSize+cellId;if(cellId!==sourceCellId&&this.shouldSkipFixedPortHalo(flatIdx,connId))return;let existing=this.usedCellsFlat[flatIdx],allowSameRootOverlap=this.allowSharedUse(connId,existing);existing!==-1&&existing!==connId&&!allowSameRootOverlap||(existing!==-1&&existing!==connId?this.addSharedOccupant(flatIdx,connId):this.usedCellsFlat[flatIdx]=connId,indices.push(flatIdx))})}markViaFootprint(connId,sourceCellId,indices,displacedByVias){let cx3=this.cellCenterX[sourceCellId],cy3=this.cellCenterY[sourceCellId];this.forEachCellNearCircle(cx3,cy3,this.viaKeepoutRadius,cellId=>{if(circleIntersectsRect2(cx3,cy3,this.viaKeepoutRadius,this.cellMinX[cellId],this.cellMinY[cellId],this.cellMaxX[cellId],this.cellMaxY[cellId]))for(let z4=0;z4<this.layers;z4++){let flatIdx=z4*this.planeSize+cellId;if(cellId!==sourceCellId&&this.shouldSkipFixedPortHalo(flatIdx,connId))continue;if(this.fillTraceOccupants(flatIdx,connId,this._cellOccs),this._cellOccs.length>0){for(let i3=0;i3<this._cellOccs.length;i3++)pushUnique2(displacedByVias,this._cellOccs[i3]);this.replaceOccupants(flatIdx,connId),indices.push(flatIdx);continue}let existing=this.usedCellsFlat[flatIdx];existing!==-1&&existing!==connId?this.addSharedOccupant(flatIdx,connId):this.usedCellsFlat[flatIdx]=connId,indices.push(flatIdx)}})}forEachCellNearCircle(cx3,cy3,radius,visitor){let minFineCol=clamp32(Math.floor((cx3-radius-this.boundsMinX)/this.highResolutionCellSize),0,this.fineCols-1),maxFineCol=clamp32(Math.floor((cx3+radius-this.boundsMinX)/this.highResolutionCellSize),0,this.fineCols-1),minFineRow=clamp32(Math.floor((cy3-radius-this.boundsMinY)/this.highResolutionCellSize),0,this.fineRows-1),maxFineRow=clamp32(Math.floor((cy3+radius-this.boundsMinY)/this.highResolutionCellSize),0,this.fineRows-1);for(let regionIdx=0;regionIdx<this.regions.length;regionIdx++){let region=this.regions[regionIdx];if(region.rows===0||region.cols===0)continue;let regionFineRowMin=Math.max(minFineRow,region.fineOriginRow),regionFineRowMax=Math.min(maxFineRow,region.fineOriginRow+region.fineRows-1),regionFineColMin=Math.max(minFineCol,region.fineOriginCol),regionFineColMax=Math.min(maxFineCol,region.fineOriginCol+region.fineCols-1);if(regionFineRowMin>regionFineRowMax||regionFineColMin>regionFineColMax)continue;let localRowMin=Math.floor((regionFineRowMin-region.fineOriginRow)/region.cellScale),localRowMax=Math.floor((regionFineRowMax-region.fineOriginRow)/region.cellScale),localColMin=Math.floor((regionFineColMin-region.fineOriginCol)/region.cellScale),localColMax=Math.floor((regionFineColMax-region.fineOriginCol)/region.cellScale);for(let row=localRowMin;row<=localRowMax;row++)for(let col=localColMin;col<=localColMax;col++)visitor(this.cellIdFor(region.id,row,col))}}ripTrace(connId){for(;this.ripCount.length<=connId;)this.ripCount.push(0);if(this.ripCount[connId]++,this.totalRipEvents++,this.totalRipEvents>=this.MAX_RIPS){this.error=`Convergence failure: exceeded MAX_RIPS ${this.MAX_RIPS}`,this.failed=!0;return}let route=this.solvedRoutes[connId];if(route){for(let i3=0;i3<route.states.length;i3++){let cellId=route.states[i3]%this.planeSize;this.penalty2d[cellId]=this.penalty2d[cellId]+this.hyperParameters.ripTracePenalty}for(let i3=0;i3<route.viaCellIds.length;i3++){let cellId=route.viaCellIds[i3];this.penalty2d[cellId]=this.penalty2d[cellId]+this.hyperParameters.ripViaPenalty}}let indices=this.usedIndicesByConn[connId];if(indices){for(let i3=0;i3<indices.length;i3++)this.removeOccupant(indices[i3],connId);this.usedIndicesByConn[connId]=void 0}if(route){this.solvedRoutes[connId]=void 0;let first=route.states[0],last=route.states[route.states.length-1],startZ=Math.floor(first/this.planeSize),endZ=Math.floor(last/this.planeSize);this.unsolvedSegs.push({connId,startZ,startCellId:first-startZ*this.planeSize,startPoint:route.startPoint,endZ,endCellId:last-endZ*this.planeSize,endPoint:route.endPoint})}}flattenNeighborLists(neighbors){let offset=new Int32Array(neighbors.length+1),total=0;for(let i3=0;i3<neighbors.length;i3++)offset[i3]=total,total+=neighbors[i3].length;offset[neighbors.length]=total;let ids=new Int32Array(total),costs=new Float32Array(total),cursor=0;for(let i3=0;i3<neighbors.length;i3++){let edges=neighbors[i3];for(let j4=0;j4<edges.length;j4++){let edge=edges[j4];ids[cursor]=edge.cellId,costs[cursor]=edge.cost,cursor++}}return{offset,ids,costs}}visualize(){let LAYER_COLORS2=["red","blue","orange","green"],vt3=this.gridToBoundsTransform,points=[],lines=[],circles=[],rects=[];if(rects.push({center:{x:this.nodeWithPortPoints.center.x,y:this.nodeWithPortPoints.center.y},width:this.nodeWithPortPoints.width,height:this.nodeWithPortPoints.height,stroke:"gray"}),this.showPenaltyMap&&this.penalty2d){let maxPenalty=0;for(let i3=0;i3<this.penalty2d.length;i3++)this.penalty2d[i3]>maxPenalty&&(maxPenalty=this.penalty2d[i3]);if(maxPenalty>0)for(let cellId=0;cellId<this.planeSize;cellId++){let penalty=this.penalty2d[cellId];if(penalty<=0)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]}),alpha=Math.min(.6,penalty/maxPenalty*.6);rects.push({center:tc3,width:this.cellWidth[cellId]*vt3.a,height:this.cellHeight[cellId]*vt3.e,fill:`rgba(255,165,0,${alpha.toFixed(3)})`})}}if(this.showUsedCellMap&&this.usedCellsFlat)for(let z4=0;z4<this.layers;z4++){let zBase=z4*this.planeSize;for(let cellId=0;cellId<this.planeSize;cellId++){if(this.usedCellsFlat[zBase+cellId]===-1)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]});rects.push({center:tc3,width:this.cellWidth[cellId]*vt3.a,height:this.cellHeight[cellId]*vt3.e,fill:"rgba(0,0,255,0.5)"})}}for(let pp3 of this.nodeWithPortPoints.portPoints)points.push({x:pp3.x,y:pp3.y,color:LAYER_COLORS2[pp3.z]??"gray",label:pp3.connectionName});let TRACE_COLORS3=["rgba(255,0,0,0.75)","rgba(0,0,255,0.75)","rgba(255,165,0,0.75)","rgba(0,128,0,0.75)"],transformedRoutes=this.getOutput();for(let route of transformedRoutes){if(route.route.length<2)continue;let segStart=0;for(let i3=1;i3<route.route.length;i3++){let prev=route.route[i3-1];route.route[i3].z!==prev.z&&(i3-segStart>=2&&lines.push({points:route.route.slice(segStart,i3).map(p4=>({x:p4.x,y:p4.y})),strokeColor:TRACE_COLORS3[prev.z]??"rgba(128,128,128,0.75)",strokeWidth:this.traceThickness}),segStart=i3)}if(route.route.length-segStart>=2){let lastZ=route.route[segStart].z;lines.push({points:route.route.slice(segStart).map(p4=>({x:p4.x,y:p4.y})),strokeColor:TRACE_COLORS3[lastZ]??"rgba(128,128,128,0.75)",strokeWidth:this.traceThickness})}}for(let route of transformedRoutes)for(let via of route.vias)circles.push({center:{x:via.x,y:via.y},radius:this.viaDiameter/2,fill:"rgba(0,0,0,0.3)",stroke:"black"});if(this.activeConnSeg&&this.visitedFlatStamp){let currentStamp=this.stamp;for(let z4=0;z4<this.layers;z4++){let zBase=z4*this.planeSize;for(let cellId=0;cellId<this.planeSize;cellId++){if(this.visitedFlatStamp[zBase+cellId]!==currentStamp)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]});points.push({x:tc3.x,y:tc3.y,color:"rgba(0,0,255,0.2)"})}}}return{points,lines,circles,rects,coordinateSystem:"cartesian",title:`HighDensityA03 [${this.getSolvedRouteCount()} solved, ${this.unsolvedSegs?.length??0} remaining]`}}getOutput(){let t52=this.gridToBoundsTransform,result=[];for(let connId=0;connId<this.solvedRoutes.length;connId++){let route=this.solvedRoutes[connId];if(!route)continue;let connName=this.connIdToName[connId],points=Array.from(route.states,state2=>{let z4=Math.floor(state2/this.planeSize),cellId=state2-z4*this.planeSize,tp3=applyAffineTransformToPoint(t52,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]});return{x:tp3.x,y:tp3.y,z:this.layerToZ.get(z4)??z4}});points.length>0&&(points[0]={...route.startPoint},points.length>1&&(points[points.length-1]={...route.endPoint})),result.push({connectionName:connName,traceThickness:this.traceThickness,viaDiameter:this.viaDiameter,route:points,vias:Array.from(route.viaCellIds,cellId=>applyAffineTransformToPoint(t52,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]}))})}return result}getSolvedRouteCount(){let count=0;for(let i3=0;i3<this.solvedRoutes.length;i3++)this.solvedRoutes[i3]&&count++;return count}computeGridToBoundsTransform(){let minCenterX=1/0,maxCenterX=-1/0,minCenterY=1/0,maxCenterY=-1/0;for(let cellId=0;cellId<this.planeSize;cellId++){let centerX=this.cellCenterX[cellId],centerY=this.cellCenterY[cellId];centerX<minCenterX&&(minCenterX=centerX),centerX>maxCenterX&&(maxCenterX=centerX),centerY<minCenterY&&(minCenterY=centerY),centerY>maxCenterY&&(maxCenterY=centerY)}let xSpan=maxCenterX-minCenterX,ySpan=maxCenterY-minCenterY,width=this.boundsMaxX-this.boundsMinX,height=this.boundsMaxY-this.boundsMinY,a3=xSpan>0?width/xSpan:1,e5=ySpan>0?height/ySpan:1,c4=xSpan>0?this.boundsMinX-a3*minCenterX:(this.boundsMinX+this.boundsMaxX)/2-minCenterX,f3=ySpan>0?this.boundsMinY-e5*minCenterY:(this.boundsMinY+this.boundsMaxY)/2-minCenterY;return{a:a3,b:0,c:c4,d:0,e:e5,f:f3}}};var ROUNDING_PRECISION=1e3;var BOUNDARY_INSET=1/ROUNDING_PRECISION;var VIA_BORDER_EXTRA_CLEARANCE=.15,VIA_SEGMENT_TARGET_CLEARANCE=.4;var VIA_BORDER_TARGET_CLEARANCE=VIA_SEGMENT_TARGET_CLEARANCE+VIA_BORDER_EXTRA_CLEARANCE+.1,VIA_BORDER_FALLOFF_DISTANCE=VIA_BORDER_TARGET_CLEARANCE+.05;var defaultParams={cellSizeMm:.1,traceMargin:.15,traceThickness:.1,viaDiameter:.3,viaMinDistFromBorder:.15},defaultA03Params={highResolutionCellSize:.1,highResolutionCellThickness:8,lowResolutionCellSize:.4,traceMargin:.15,traceThickness:.1,viaDiameter:.3,viaMinDistFromBorder:.15},defaultA08Params={...defaultParams,stepMultiplier:1,showPenaltyMap:!1,showUsedCellMap:!1,effort:1,initialRectMarginMm:.2,rectShrinkStepMm:.1,breakoutTraceMarginMm:.1,breakoutSegmentCount:2,breakoutMaxIterationsPerRect:60,breakoutForceStepSize:.2,breakoutRepulsionStrength:1.8,breakoutSmoothingStrength:.16,breakoutAttractionStrength:.06,innerPortSpreadFactor:1},defaultA09Params={...defaultA03Params,effort:1,boundaryBonus:.18,boundaryBonusSigma:.22,portShadowStrength:.55,portShadowTangentSigma:.18,portShadowDepthSigma:.5,fullOrderSearchConnectionCountLimit:6,priorityHeadSize:4,maxCandidateOrders:720};var import_object_hash=__toESM(require_object_hash(),1),import_object_hash2=__toESM(require_object_hash(),1),import_object_hash3=__toESM(require_object_hash(),1);var t=Object.create,e2=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,r3=Object.prototype.hasOwnProperty,s=(t52,e5)=>function(){return e5||(0,t52[o(t52)[0]])((e5={exports:{}}).exports,e5),e5.exports},a=(t52,n4)=>{for(var o4 in n4)e2(t52,o4,{get:n4[o4],enumerable:!0})},c=(s3,a3,c4)=>(c4=s3!=null?t(i(s3)):{},((t52,i3,s4,a4)=>{if(i3&&typeof i3=="object"||typeof i3=="function")for(let c5 of o(i3))r3.call(t52,c5)||c5===s4||e2(t52,c5,{get:()=>i3[c5],enumerable:!(a4=n(i3,c5))||a4.enumerable});return t52})(!a3&&s3&&s3.__esModule?c4:e2(c4,"default",{value:s3,enumerable:!0}),s3)),l=s({"node_modules/is-buffer/index.js"(t52,e5){function n4(t53){return!!t53.constructor&&typeof t53.constructor.isBuffer=="function"&&t53.constructor.isBuffer(t53)}e5.exports=function(t53){return t53!=null&&(n4(t53)||(function(t54){return typeof t54.readFloatLE=="function"&&typeof t54.slice=="function"&&n4(t54.slice(0,0))})(t53)||!!t53._isBuffer)}}}),h=s({"node_modules/kind-of/index.js"(t52,e5){var n4=l(),o4=Object.prototype.toString;e5.exports=function(t53){if(t53===void 0)return"undefined";if(t53===null)return"null";if(t53===!0||t53===!1||t53 instanceof Boolean)return"boolean";if(typeof t53=="string"||t53 instanceof String)return"string";if(typeof t53=="number"||t53 instanceof Number)return"number";if(typeof t53=="function"||t53 instanceof Function)return"function";if(Array.isArray!==void 0&&Array.isArray(t53))return"array";if(t53 instanceof RegExp)return"regexp";if(t53 instanceof Date)return"date";var e6=o4.call(t53);return e6==="[object RegExp]"?"regexp":e6==="[object Date]"?"date":e6==="[object Arguments]"?"arguments":e6==="[object Error]"?"error":n4(t53)?"buffer":e6==="[object Set]"?"set":e6==="[object WeakSet]"?"weakset":e6==="[object Map]"?"map":e6==="[object WeakMap]"?"weakmap":e6==="[object Symbol]"?"symbol":e6==="[object Int8Array]"?"int8array":e6==="[object Uint8Array]"?"uint8array":e6==="[object Uint8ClampedArray]"?"uint8clampedarray":e6==="[object Int16Array]"?"int16array":e6==="[object Uint16Array]"?"uint16array":e6==="[object Int32Array]"?"int32array":e6==="[object Uint32Array]"?"uint32array":e6==="[object Float32Array]"?"float32array":e6==="[object Float64Array]"?"float64array":"object"}}}),d=s({"node_modules/rename-keys/index.js"(t52,e5){(function(){function t53(t54,e6){if(typeof e6!="function")return t54;var n4={};for(var o4 in t54)Object.prototype.hasOwnProperty.call(t54,o4)&&(n4[e6(o4,t54[o4])||o4]=t54[o4]);return n4}e5!==void 0&&e5.exports?e5.exports=t53:typeof define=="function"&&define.amd?define([],function(){return t53}):window.rename=t53})()}}),u3=s({"node_modules/deep-rename-keys/index.js"(t52,e5){var n4=h(),o4=d();e5.exports=function t53(e6,i3){var r5=n4(e6);if(r5!=="object"&&r5!=="array")throw new Error("expected an object");var s3=[];for(var a3 in r5==="object"&&(e6=o4(e6,i3),s3={}),e6)if(e6.hasOwnProperty(a3)){var c4=e6[a3];n4(c4)==="object"||n4(c4)==="array"?s3[a3]=t53(c4,i3):s3[a3]=c4}return s3}}}),p=s({"node_modules/xml-reader/node_modules/eventemitter3/index.js"(t52,e5){var n4=Object.prototype.hasOwnProperty,o4="~";function i3(){}function r5(t53,e6,n5){this.fn=t53,this.context=e6,this.once=n5||!1}function s3(){this._events=new i3,this._eventsCount=0}Object.create&&(i3.prototype=Object.create(null),new i3().__proto__||(o4=!1)),s3.prototype.eventNames=function(){var t53,e6,i4=[];if(this._eventsCount===0)return i4;for(e6 in t53=this._events)n4.call(t53,e6)&&i4.push(o4?e6.slice(1):e6);return Object.getOwnPropertySymbols?i4.concat(Object.getOwnPropertySymbols(t53)):i4},s3.prototype.listeners=function(t53,e6){var n5=o4?o4+t53:t53,i4=this._events[n5];if(e6)return!!i4;if(!i4)return[];if(i4.fn)return[i4.fn];for(var r6=0,s4=i4.length,a3=new Array(s4);r6<s4;r6++)a3[r6]=i4[r6].fn;return a3},s3.prototype.emit=function(t53,e6,n5,i4,r6,s4){var a3=o4?o4+t53:t53;if(!this._events[a3])return!1;var c4,l4,h6=this._events[a3],d4=arguments.length;if(h6.fn){switch(h6.once&&this.removeListener(t53,h6.fn,void 0,!0),d4){case 1:return h6.fn.call(h6.context),!0;case 2:return h6.fn.call(h6.context,e6),!0;case 3:return h6.fn.call(h6.context,e6,n5),!0;case 4:return h6.fn.call(h6.context,e6,n5,i4),!0;case 5:return h6.fn.call(h6.context,e6,n5,i4,r6),!0;case 6:return h6.fn.call(h6.context,e6,n5,i4,r6,s4),!0}for(l4=1,c4=new Array(d4-1);l4<d4;l4++)c4[l4-1]=arguments[l4];h6.fn.apply(h6.context,c4)}else{var u5,p4=h6.length;for(l4=0;l4<p4;l4++)switch(h6[l4].once&&this.removeListener(t53,h6[l4].fn,void 0,!0),d4){case 1:h6[l4].fn.call(h6[l4].context);break;case 2:h6[l4].fn.call(h6[l4].context,e6);break;case 3:h6[l4].fn.call(h6[l4].context,e6,n5);break;case 4:h6[l4].fn.call(h6[l4].context,e6,n5,i4);break;default:if(!c4)for(u5=1,c4=new Array(d4-1);u5<d4;u5++)c4[u5-1]=arguments[u5];h6[l4].fn.apply(h6[l4].context,c4)}}return!0},s3.prototype.on=function(t53,e6,n5){var i4=new r5(e6,n5||this),s4=o4?o4+t53:t53;return this._events[s4]?this._events[s4].fn?this._events[s4]=[this._events[s4],i4]:this._events[s4].push(i4):(this._events[s4]=i4,this._eventsCount++),this},s3.prototype.once=function(t53,e6,n5){var i4=new r5(e6,n5||this,!0),s4=o4?o4+t53:t53;return this._events[s4]?this._events[s4].fn?this._events[s4]=[this._events[s4],i4]:this._events[s4].push(i4):(this._events[s4]=i4,this._eventsCount++),this},s3.prototype.removeListener=function(t53,e6,n5,r6){var s4=o4?o4+t53:t53;if(!this._events[s4])return this;if(!e6)return--this._eventsCount===0?this._events=new i3:delete this._events[s4],this;var a3=this._events[s4];if(a3.fn)a3.fn!==e6||r6&&!a3.once||n5&&a3.context!==n5||(--this._eventsCount===0?this._events=new i3:delete this._events[s4]);else{for(var c4=0,l4=[],h6=a3.length;c4<h6;c4++)(a3[c4].fn!==e6||r6&&!a3[c4].once||n5&&a3[c4].context!==n5)&&l4.push(a3[c4]);l4.length?this._events[s4]=l4.length===1?l4[0]:l4:--this._eventsCount===0?this._events=new i3:delete this._events[s4]}return this},s3.prototype.removeAllListeners=function(t53){var e6;return t53?(e6=o4?o4+t53:t53,this._events[e6]&&(--this._eventsCount===0?this._events=new i3:delete this._events[e6])):(this._events=new i3,this._eventsCount=0),this},s3.prototype.off=s3.prototype.removeListener,s3.prototype.addListener=s3.prototype.on,s3.prototype.setMaxListeners=function(){return this},s3.prefixed=o4,s3.EventEmitter=s3,e5!==void 0&&(e5.exports=s3)}}),m=s({"node_modules/xml-lexer/node_modules/eventemitter3/index.js"(t52,e5){var n4=Object.prototype.hasOwnProperty,o4="~";function i3(){}function r5(t53,e6,n5){this.fn=t53,this.context=e6,this.once=n5||!1}function s3(){this._events=new i3,this._eventsCount=0}Object.create&&(i3.prototype=Object.create(null),new i3().__proto__||(o4=!1)),s3.prototype.eventNames=function(){var t53,e6,i4=[];if(this._eventsCount===0)return i4;for(e6 in t53=this._events)n4.call(t53,e6)&&i4.push(o4?e6.slice(1):e6);return Object.getOwnPropertySymbols?i4.concat(Object.getOwnPropertySymbols(t53)):i4},s3.prototype.listeners=function(t53,e6){var n5=o4?o4+t53:t53,i4=this._events[n5];if(e6)return!!i4;if(!i4)return[];if(i4.fn)return[i4.fn];for(var r6=0,s4=i4.length,a3=new Array(s4);r6<s4;r6++)a3[r6]=i4[r6].fn;return a3},s3.prototype.emit=function(t53,e6,n5,i4,r6,s4){var a3=o4?o4+t53:t53;if(!this._events[a3])return!1;var c4,l4,h6=this._events[a3],d4=arguments.length;if(h6.fn){switch(h6.once&&this.removeListener(t53,h6.fn,void 0,!0),d4){case 1:return h6.fn.call(h6.context),!0;case 2:return h6.fn.call(h6.context,e6),!0;case 3:return h6.fn.call(h6.context,e6,n5),!0;case 4:return h6.fn.call(h6.context,e6,n5,i4),!0;case 5:return h6.fn.call(h6.context,e6,n5,i4,r6),!0;case 6:return h6.fn.call(h6.context,e6,n5,i4,r6,s4),!0}for(l4=1,c4=new Array(d4-1);l4<d4;l4++)c4[l4-1]=arguments[l4];h6.fn.apply(h6.context,c4)}else{var u5,p4=h6.length;for(l4=0;l4<p4;l4++)switch(h6[l4].once&&this.removeListener(t53,h6[l4].fn,void 0,!0),d4){case 1:h6[l4].fn.call(h6[l4].context);break;case 2:h6[l4].fn.call(h6[l4].context,e6);break;case 3:h6[l4].fn.call(h6[l4].context,e6,n5);break;case 4:h6[l4].fn.call(h6[l4].context,e6,n5,i4);break;default:if(!c4)for(u5=1,c4=new Array(d4-1);u5<d4;u5++)c4[u5-1]=arguments[u5];h6[l4].fn.apply(h6[l4].context,c4)}}return!0},s3.prototype.on=function(t53,e6,n5){var i4=new r5(e6,n5||this),s4=o4?o4+t53:t53;return this._events[s4]?this._events[s4].fn?this._events[s4]=[this._events[s4],i4]:this._events[s4].push(i4):(this._events[s4]=i4,this._eventsCount++),this},s3.prototype.once=function(t53,e6,n5){var i4=new r5(e6,n5||this,!0),s4=o4?o4+t53:t53;return this._events[s4]?this._events[s4].fn?this._events[s4]=[this._events[s4],i4]:this._events[s4].push(i4):(this._events[s4]=i4,this._eventsCount++),this},s3.prototype.removeListener=function(t53,e6,n5,r6){var s4=o4?o4+t53:t53;if(!this._events[s4])return this;if(!e6)return--this._eventsCount===0?this._events=new i3:delete this._events[s4],this;var a3=this._events[s4];if(a3.fn)a3.fn!==e6||r6&&!a3.once||n5&&a3.context!==n5||(--this._eventsCount===0?this._events=new i3:delete this._events[s4]);else{for(var c4=0,l4=[],h6=a3.length;c4<h6;c4++)(a3[c4].fn!==e6||r6&&!a3[c4].once||n5&&a3[c4].context!==n5)&&l4.push(a3[c4]);l4.length?this._events[s4]=l4.length===1?l4[0]:l4:--this._eventsCount===0?this._events=new i3:delete this._events[s4]}return this},s3.prototype.removeAllListeners=function(t53){var e6;return t53?(e6=o4?o4+t53:t53,this._events[e6]&&(--this._eventsCount===0?this._events=new i3:delete this._events[e6])):(this._events=new i3,this._eventsCount=0),this},s3.prototype.off=s3.prototype.removeListener,s3.prototype.addListener=s3.prototype.on,s3.prototype.setMaxListeners=function(){return this},s3.prefixed=o4,s3.EventEmitter=s3,e5!==void 0&&(e5.exports=s3)}}),g4=s({"node_modules/xml-lexer/dist/lexer.js"(t52,e5){function n4(t53,e6,n5){return e6 in t53?Object.defineProperty(t53,e6,{value:n5,enumerable:!0,configurable:!0,writable:!0}):t53[e6]=n5,t53}var o4=m(),i3=function(){},r5={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},s3={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},a3={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},c4={" ":s3.space," ":s3.space,"\n":s3.space,"\r":s3.space,"<":s3.lt,">":s3.gt,'"':s3.quote,"'":s3.quote,"=":s3.equal,"/":s3.slash};e5.exports={State:r5,Action:s3,Type:a3,create:function(t53){var e6,l4,h6,d4,u5,p4,m4,g6,f3,_4;t53=Object.assign({debug:!1},t53);var y4=new o4,b3=r5.data,x4="",v4="",S3="",I4="",P4="",M4="",N4=function(e7,n5){if(v4[0]!=="?"&&v4[0]!=="!"){var o6={type:e7,value:n5};t53.debug&&console.log("emit:",o6),y4.emit("data",o6)}};y4.stateMachine=(n4(_4={},r5.data,(n4(e6={},s3.lt,function(){x4.trim()&&N4(a3.text,x4),v4="",P4=!1,b3=r5.tagBegin}),n4(e6,s3.char,function(t54){x4+=t54}),e6)),n4(_4,r5.cdata,n4({},s3.char,function(t54){(x4+=t54).substr(-3)==="]]>"&&(N4(a3.text,x4.slice(0,-3)),x4="",b3=r5.data)})),n4(_4,r5.tagBegin,(n4(l4={},s3.space,i3),n4(l4,s3.char,function(t54){v4=t54,b3=r5.tagName}),n4(l4,s3.slash,function(){v4="",P4=!0}),l4)),n4(_4,r5.tagName,(n4(h6={},s3.space,function(){P4?b3=r5.tagEnd:(b3=r5.attributeNameStart,N4(a3.openTag,v4))}),n4(h6,s3.gt,function(){N4(P4?a3.closeTag:a3.openTag,v4),x4="",b3=r5.data}),n4(h6,s3.slash,function(){b3=r5.tagEnd,N4(a3.openTag,v4)}),n4(h6,s3.char,function(t54){(v4+=t54)==="![CDATA["&&(b3=r5.cdata,x4="",v4="")}),h6)),n4(_4,r5.tagEnd,(n4(d4={},s3.gt,function(){N4(a3.closeTag,v4),x4="",b3=r5.data}),n4(d4,s3.char,i3),d4)),n4(_4,r5.attributeNameStart,(n4(u5={},s3.char,function(t54){S3=t54,b3=r5.attributeName}),n4(u5,s3.gt,function(){x4="",b3=r5.data}),n4(u5,s3.space,i3),n4(u5,s3.slash,function(){P4=!0,b3=r5.tagEnd}),u5)),n4(_4,r5.attributeName,(n4(p4={},s3.space,function(){b3=r5.attributeNameEnd}),n4(p4,s3.equal,function(){N4(a3.attributeName,S3),b3=r5.attributeValueBegin}),n4(p4,s3.gt,function(){I4="",N4(a3.attributeName,S3),N4(a3.attributeValue,I4),x4="",b3=r5.data}),n4(p4,s3.slash,function(){P4=!0,I4="",N4(a3.attributeName,S3),N4(a3.attributeValue,I4),b3=r5.tagEnd}),n4(p4,s3.char,function(t54){S3+=t54}),p4)),n4(_4,r5.attributeNameEnd,(n4(m4={},s3.space,i3),n4(m4,s3.equal,function(){N4(a3.attributeName,S3),b3=r5.attributeValueBegin}),n4(m4,s3.gt,function(){I4="",N4(a3.attributeName,S3),N4(a3.attributeValue,I4),x4="",b3=r5.data}),n4(m4,s3.char,function(t54){I4="",N4(a3.attributeName,S3),N4(a3.attributeValue,I4),S3=t54,b3=r5.attributeName}),m4)),n4(_4,r5.attributeValueBegin,(n4(g6={},s3.space,i3),n4(g6,s3.quote,function(t54){M4=t54,I4="",b3=r5.attributeValue}),n4(g6,s3.gt,function(){N4(a3.attributeValue,I4=""),x4="",b3=r5.data}),n4(g6,s3.char,function(t54){M4="",I4=t54,b3=r5.attributeValue}),g6)),n4(_4,r5.attributeValue,(n4(f3={},s3.space,function(t54){M4?I4+=t54:(N4(a3.attributeValue,I4),b3=r5.attributeNameStart)}),n4(f3,s3.quote,function(t54){M4===t54?(N4(a3.attributeValue,I4),b3=r5.attributeNameStart):I4+=t54}),n4(f3,s3.gt,function(t54){M4?I4+=t54:(N4(a3.attributeValue,I4),x4="",b3=r5.data)}),n4(f3,s3.slash,function(t54){M4?I4+=t54:(N4(a3.attributeValue,I4),P4=!0,b3=r5.tagEnd)}),n4(f3,s3.char,function(t54){I4+=t54}),f3)),_4);var C4=function(e7){t53.debug&&console.log(b3,e7);var n5=y4.stateMachine[b3],o6=n5[(function(t54){return c4[t54]||s3.char})(e7)]||n5[s3.error]||n5[s3.char];o6(e7)};return y4.write=function(t54){for(var e7=t54.length,n5=0;n5<e7;n5++)C4(t54[n5])},y4}}}}),f=s({"node_modules/xml-reader/dist/reader.js"(t52,e5){var n4=p(),o4=g4(),i3=o4.Type,r5={element:"element",text:"text"},s3=function(t53){return Object.assign({name:"",type:r5.element,value:"",parent:null,attributes:{},children:[]},t53)},a3=function(t53){t53=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},t53);var e6=void 0,a4=void 0,c4=void 0,l4=void 0,h6=new n4,d4=function(n5){switch(n5.type){case i3.openTag:if(c4===null)(c4=a4).name=n5.value;else{var o6=s3({name:n5.value,parent:c4});c4.children.push(o6),c4=o6}break;case i3.closeTag:var d5=c4.parent;if(t53.parentNodes||(c4.parent=null),c4.name!==n5.value)break;t53.stream&&d5===a4&&(a4.children=[],c4.parent=null),t53.emitTopLevelOnly&&d5!==a4||(h6.emit(t53.tagPrefix+c4.name,c4),h6.emit("tag",c4.name,c4)),c4===a4&&(e6.removeAllListeners("data"),h6.emit(t53.doneEvent,c4),a4=null),c4=d5;break;case i3.text:c4&&c4.children.push(s3({type:r5.text,value:n5.value,parent:t53.parentNodes?c4:null}));break;case i3.attributeName:l4=n5.value,c4.attributes[l4]="";break;case i3.attributeValue:c4.attributes[l4]=n5.value}};return h6.reset=function(){(e6=o4.create({debug:t53.debug})).on("data",d4),a4=s3(),c4=null,l4="",h6.parse=e6.write},h6.reset(),h6};e5.exports={parseSync:function(t53,e6){e6=Object.assign({},e6,{stream:!1,tagPrefix:":"});var n5=a3(e6),o6=void 0;return n5.on("done",function(t54){o6=t54}),n5.parse(t53),o6},create:a3,NodeType:r5}}}),_3=s({"node_modules/binary-search-bounds/search-bounds.js"(t52,e5){function n4(t53,e6,n5,o6,i4){for(var r6=i4+1;o6<=i4;){var s4=o6+i4>>>1,a4=t53[s4];(n5!==void 0?n5(a4,e6):a4-e6)>=0?(r6=s4,i4=s4-1):o6=s4+1}return r6}function o4(t53,e6,n5,o6,i4){for(var r6=i4+1;o6<=i4;){var s4=o6+i4>>>1,a4=t53[s4];(n5!==void 0?n5(a4,e6):a4-e6)>0?(r6=s4,i4=s4-1):o6=s4+1}return r6}function i3(t53,e6,n5,o6,i4){for(var r6=o6-1;o6<=i4;){var s4=o6+i4>>>1,a4=t53[s4];(n5!==void 0?n5(a4,e6):a4-e6)<0?(r6=s4,o6=s4+1):i4=s4-1}return r6}function r5(t53,e6,n5,o6,i4){for(var r6=o6-1;o6<=i4;){var s4=o6+i4>>>1,a4=t53[s4];(n5!==void 0?n5(a4,e6):a4-e6)<=0?(r6=s4,o6=s4+1):i4=s4-1}return r6}function s3(t53,e6,n5,o6,i4){for(;o6<=i4;){var r6=o6+i4>>>1,s4=t53[r6],a4=n5!==void 0?n5(s4,e6):s4-e6;if(a4===0)return r6;a4<=0?o6=r6+1:i4=r6-1}return-1}function a3(t53,e6,n5,o6,i4,r6){return typeof n5=="function"?r6(t53,e6,n5,o6===void 0?0:0|o6,i4===void 0?t53.length-1:0|i4):r6(t53,e6,void 0,n5===void 0?0:0|n5,o6===void 0?t53.length-1:0|o6)}e5.exports={ge:function(t53,e6,o6,i4,r6){return a3(t53,e6,o6,i4,r6,n4)},gt:function(t53,e6,n5,i4,r6){return a3(t53,e6,n5,i4,r6,o4)},lt:function(t53,e6,n5,o6,r6){return a3(t53,e6,n5,o6,r6,i3)},le:function(t53,e6,n5,o6,i4){return a3(t53,e6,n5,o6,i4,r5)},eq:function(t53,e6,n5,o6,i4){return a3(t53,e6,n5,o6,i4,s3)}}}}),y=s({"node_modules/two-product/two-product.js"(t52,e5){e5.exports=function(t53,e6,o4){var i3=t53*e6,r5=n4*t53,s3=r5-(r5-t53),a3=t53-s3,c4=n4*e6,l4=c4-(c4-e6),h6=e6-l4,d4=a3*h6-(i3-s3*l4-a3*l4-s3*h6);return o4?(o4[0]=d4,o4[1]=i3,o4):[d4,i3]};var n4=+(Math.pow(2,27)+1)}}),b=s({"node_modules/robust-sum/robust-sum.js"(t52,e5){e5.exports=function(t53,e6){var n4=0|t53.length,o4=0|e6.length;if(n4===1&&o4===1)return(function(t54,e7){var n5=t54+e7,o6=n5-t54,i4=n5-o6,r6=e7-o6,s4=t54-i4,a4=s4+r6;return a4?[a4,n5]:[n5]})(t53[0],e6[0]);var i3,r5,s3=new Array(n4+o4),a3=0,c4=0,l4=0,h6=Math.abs,d4=t53[c4],u5=h6(d4),p4=e6[l4],m4=h6(p4);u5<m4?(r5=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(r5=p4,(l4+=1)<o4&&(m4=h6(p4=e6[l4]))),c4<n4&&u5<m4||l4>=o4?(i3=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(i3=p4,(l4+=1)<o4&&(m4=h6(p4=e6[l4])));for(var g6,f3,_4=i3+r5,y4=_4-i3,b3=r5-y4,x4=b3,v4=_4;c4<n4&&l4<o4;)u5<m4?(i3=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(i3=p4,(l4+=1)<o4&&(m4=h6(p4=e6[l4]))),(b3=(r5=x4)-(y4=(_4=i3+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6;for(;c4<n4;)(b3=(r5=x4)-(y4=(_4=(i3=d4)+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6,(c4+=1)<n4&&(d4=t53[c4]);for(;l4<o4;)(b3=(r5=x4)-(y4=(_4=(i3=p4)+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6,(l4+=1)<o4&&(p4=e6[l4]);return x4&&(s3[a3++]=x4),v4&&(s3[a3++]=v4),a3||(s3[a3++]=0),s3.length=a3,s3}}}),x3=s({"node_modules/two-sum/two-sum.js"(t52,e5){e5.exports=function(t53,e6,n4){var o4=t53+e6,i3=o4-t53,r5=e6-i3,s3=t53-(o4-i3);return n4?(n4[0]=s3+r5,n4[1]=o4,n4):[s3+r5,o4]}}}),v3=s({"node_modules/robust-scale/robust-scale.js"(t52,e5){var n4=y(),o4=x3();e5.exports=function(t53,e6){var i3=t53.length;if(i3===1){var r5=n4(t53[0],e6);return r5[0]?r5:[r5[1]]}var s3=new Array(2*i3),a3=[.1,.1],c4=[.1,.1],l4=0;n4(t53[0],e6,a3),a3[0]&&(s3[l4++]=a3[0]);for(var h6=1;h6<i3;++h6){n4(t53[h6],e6,c4);var d4=a3[1];o4(d4,c4[0],a3),a3[0]&&(s3[l4++]=a3[0]);var u5=c4[1],p4=a3[1],m4=u5+p4,g6=p4-(m4-u5);a3[1]=m4,g6&&(s3[l4++]=g6)}return a3[1]&&(s3[l4++]=a3[1]),l4===0&&(s3[l4++]=0),s3.length=l4,s3}}}),S2=s({"node_modules/robust-subtract/robust-diff.js"(t52,e5){e5.exports=function(t53,e6){var n4=0|t53.length,o4=0|e6.length;if(n4===1&&o4===1)return(function(t54,e7){var n5=t54+e7,o6=n5-t54,i4=n5-o6,r6=e7-o6,s4=t54-i4,a4=s4+r6;return a4?[a4,n5]:[n5]})(t53[0],-e6[0]);var i3,r5,s3=new Array(n4+o4),a3=0,c4=0,l4=0,h6=Math.abs,d4=t53[c4],u5=h6(d4),p4=-e6[l4],m4=h6(p4);u5<m4?(r5=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(r5=p4,(l4+=1)<o4&&(m4=h6(p4=-e6[l4]))),c4<n4&&u5<m4||l4>=o4?(i3=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(i3=p4,(l4+=1)<o4&&(m4=h6(p4=-e6[l4])));for(var g6,f3,_4=i3+r5,y4=_4-i3,b3=r5-y4,x4=b3,v4=_4;c4<n4&&l4<o4;)u5<m4?(i3=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(i3=p4,(l4+=1)<o4&&(m4=h6(p4=-e6[l4]))),(b3=(r5=x4)-(y4=(_4=i3+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6;for(;c4<n4;)(b3=(r5=x4)-(y4=(_4=(i3=d4)+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6,(c4+=1)<n4&&(d4=t53[c4]);for(;l4<o4;)(b3=(r5=x4)-(y4=(_4=(i3=p4)+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6,(l4+=1)<o4&&(p4=-e6[l4]);return x4&&(s3[a3++]=x4),v4&&(s3[a3++]=v4),a3||(s3[a3++]=0),s3.length=a3,s3}}}),I3=s({"node_modules/robust-orientation/orientation.js"(t52,e5){var n4=y(),o4=b(),i3=v3(),r5=S2();function s3(t53,e6,n5,o6){return function(n6,i4,r6){var s4=t53(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),t53(e6(n6[1],i4[0]),e6(-i4[1],n6[0]))),a4=t53(e6(n6[1],r6[0]),e6(-r6[1],n6[0])),c5=o6(s4,a4);return c5[c5.length-1]}}function a3(t53,e6,n5,o6){return function(i4,r6,s4,a4){var c5=t53(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),a4[2]))),t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),a4[2])))),l5=t53(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),a4[2]))),t53(n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),s4[2])))),h7=o6(c5,l5);return h7[h7.length-1]}}function c4(t53,e6,n5,o6){return function(i4,r6,s4,a4,c5){var l5=t53(t53(t53(n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),s4[2]),t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),-a4[2]),n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),c5[2]))),r6[3]),t53(n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),r6[2]),t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),-a4[2]),n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),c5[2]))),-s4[3]),n5(t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),c5[2]))),a4[3]))),t53(n5(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),a4[2]))),-c5[3]),t53(n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),r6[2]),t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),-a4[2]),n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),c5[2]))),i4[3]),n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-a4[2]),n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),c5[2]))),-r6[3])))),t53(t53(n5(t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),c5[2]))),a4[3]),t53(n5(t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),a4[2]))),-c5[3]),n5(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),a4[2]))),i4[3]))),t53(n5(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),a4[2]))),-r6[3]),t53(n5(t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),a4[2]))),s4[3]),n5(t53(n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),s4[2]))),-a4[3]))))),h7=t53(t53(t53(n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),s4[2]),t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),-a4[2]),n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),c5[2]))),i4[3]),n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-a4[2]),n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),c5[2]))),-s4[3])),t53(n5(t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),c5[2]))),a4[3]),n5(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),a4[2]))),-c5[3]))),t53(t53(n5(t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),c5[2]))),i4[3]),n5(t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),c5[2]))),-r6[3])),t53(n5(t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),c5[2]))),s4[3]),n5(t53(n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),s4[2]))),-c5[3])))),d5=o6(l5,h7);return d5[d5.length-1]}}function l4(t53){return(t53===3?s3:t53===4?a3:c4)(o4,n4,i3,r5)}var h6=l4(3),d4=l4(4),u5=[function(){return 0},function(){return 0},function(t53,e6){return e6[0]-t53[0]},function(t53,e6,n5){var o6,i4=(t53[1]-n5[1])*(e6[0]-n5[0]),r6=(t53[0]-n5[0])*(e6[1]-n5[1]),s4=i4-r6;if(i4>0){if(r6<=0)return s4;o6=i4+r6}else{if(!(i4<0)||r6>=0)return s4;o6=-(i4+r6)}var a4=33306690738754716e-32*o6;return s4>=a4||s4<=-a4?s4:h6(t53,e6,n5)},function(t53,e6,n5,o6){var i4=t53[0]-o6[0],r6=e6[0]-o6[0],s4=n5[0]-o6[0],a4=t53[1]-o6[1],c5=e6[1]-o6[1],l5=n5[1]-o6[1],h7=t53[2]-o6[2],u6=e6[2]-o6[2],p5=n5[2]-o6[2],m6=r6*l5,g6=s4*c5,f3=s4*a4,_4=i4*l5,y4=i4*c5,b3=r6*a4,x4=h7*(m6-g6)+u6*(f3-_4)+p5*(y4-b3),v4=7771561172376103e-31*((Math.abs(m6)+Math.abs(g6))*Math.abs(h7)+(Math.abs(f3)+Math.abs(_4))*Math.abs(u6)+(Math.abs(y4)+Math.abs(b3))*Math.abs(p5));return x4>v4||-x4>v4?x4:d4(t53,e6,n5,o6)}];function p4(t53){var e6=u5[t53.length];return e6||(e6=u5[t53.length]=l4(t53.length)),e6.apply(void 0,t53)}function m4(t53,e6,n5,o6,i4,r6,s4){return function(e7,n6,a4,c5,l5){switch(arguments.length){case 0:case 1:return 0;case 2:return o6(e7,n6);case 3:return i4(e7,n6,a4);case 4:return r6(e7,n6,a4,c5);case 5:return s4(e7,n6,a4,c5,l5)}for(var h7=new Array(arguments.length),d5=0;d5<arguments.length;++d5)h7[d5]=arguments[d5];return t53(h7)}}(function(){for(;u5.length<=5;)u5.push(l4(u5.length));e5.exports=m4.apply(void 0,[p4].concat(u5));for(var t53=0;t53<=5;++t53)e5.exports[t53]=u5[t53]})()}}),P2=s({"node_modules/cdt2d/lib/monotone.js"(t52,e5){var n4=_3(),o4=I3()[3];function i3(t53,e6,n5,o6,i4){this.a=t53,this.b=e6,this.idx=n5,this.lowerIds=o6,this.upperIds=i4}function r5(t53,e6,n5,o6){this.a=t53,this.b=e6,this.type=n5,this.idx=o6}function s3(t53,e6){var n5=t53.a[0]-e6.a[0]||t53.a[1]-e6.a[1]||t53.type-e6.type;return n5||(t53.type!==0&&(n5=o4(t53.a,t53.b,e6.b))?n5:t53.idx-e6.idx)}function a3(t53,e6){return o4(t53.a,t53.b,e6)}function c4(t53,e6,i4,r6,s4){for(var c5=n4.lt(e6,r6,a3),l5=n4.gt(e6,r6,a3),h7=c5;h7<l5;++h7){for(var d5=e6[h7],u5=d5.lowerIds,p4=u5.length;p4>1&&o4(i4[u5[p4-2]],i4[u5[p4-1]],r6)>0;)t53.push([u5[p4-1],u5[p4-2],s4]),p4-=1;u5.length=p4,u5.push(s4);var m4=d5.upperIds;for(p4=m4.length;p4>1&&o4(i4[m4[p4-2]],i4[m4[p4-1]],r6)<0;)t53.push([m4[p4-2],m4[p4-1],s4]),p4-=1;m4.length=p4,m4.push(s4)}}function l4(t53,e6){var n5;return(n5=t53.a[0]<e6.a[0]?o4(t53.a,t53.b,e6.a):o4(e6.b,e6.a,t53.a))?n5:(n5=e6.b[0]<t53.b[0]?o4(t53.a,t53.b,e6.b):o4(e6.b,e6.a,t53.b))||t53.idx-e6.idx}function h6(t53,e6,o6){var r6=n4.le(t53,o6,l4),s4=t53[r6],a4=s4.upperIds,c5=a4[a4.length-1];s4.upperIds=[c5],t53.splice(r6+1,0,new i3(o6.a,o6.b,o6.idx,[c5],a4))}function d4(t53,e6,o6){var i4=o6.a;o6.a=o6.b,o6.b=i4;var r6=n4.eq(t53,o6,l4),s4=t53[r6];t53[r6-1].upperIds=s4.upperIds,t53.splice(r6,1)}e5.exports=function(t53,e6){for(var n5=t53.length,o6=e6.length,a4=[],l5=0;l5<n5;++l5)a4.push(new r5(t53[l5],null,0,l5));for(l5=0;l5<o6;++l5){var u5=e6[l5],p4=t53[u5[0]],m4=t53[u5[1]];p4[0]<m4[0]?a4.push(new r5(p4,m4,2,l5),new r5(m4,p4,1,l5)):p4[0]>m4[0]&&a4.push(new r5(m4,p4,2,l5),new r5(p4,m4,1,l5))}a4.sort(s3);for(var g6=a4[0].a[0]-(1+Math.abs(a4[0].a[0]))*Math.pow(2,-52),f3=[new i3([g6,1],[g6,0],-1,[],[],[],[])],_4=[],y4=(l5=0,a4.length);l5<y4;++l5){var b3=a4[l5],x4=b3.type;x4===0?c4(_4,f3,t53,b3.a,b3.idx):x4===2?h6(f3,t53,b3):d4(f3,t53,b3)}return _4}}}),M3=s({"node_modules/cdt2d/lib/triangulation.js"(t52,e5){var n4=_3();function o4(t53,e6){this.stars=t53,this.edges=e6}e5.exports=function(t53,e6){for(var n5=new Array(t53),i4=0;i4<t53;++i4)n5[i4]=[];return new o4(n5,e6)};var i3=o4.prototype;function r5(t53,e6,n5){for(var o6=1,i4=t53.length;o6<i4;o6+=2)if(t53[o6-1]===e6&&t53[o6]===n5)return t53[o6-1]=t53[i4-2],t53[o6]=t53[i4-1],void(t53.length=i4-2)}i3.isConstraint=(function(){var t53=[0,0];function e6(t54,e7){return t54[0]-e7[0]||t54[1]-e7[1]}return function(o6,i4){return t53[0]=Math.min(o6,i4),t53[1]=Math.max(o6,i4),n4.eq(this.edges,t53,e6)>=0}})(),i3.removeTriangle=function(t53,e6,n5){var o6=this.stars;r5(o6[t53],e6,n5),r5(o6[e6],n5,t53),r5(o6[n5],t53,e6)},i3.addTriangle=function(t53,e6,n5){var o6=this.stars;o6[t53].push(e6,n5),o6[e6].push(n5,t53),o6[n5].push(t53,e6)},i3.opposite=function(t53,e6){for(var n5=this.stars[e6],o6=1,i4=n5.length;o6<i4;o6+=2)if(n5[o6]===t53)return n5[o6-1];return-1},i3.flip=function(t53,e6){var n5=this.opposite(t53,e6),o6=this.opposite(e6,t53);this.removeTriangle(t53,e6,n5),this.removeTriangle(e6,t53,o6),this.addTriangle(t53,o6,n5),this.addTriangle(e6,n5,o6)},i3.edges=function(){for(var t53=this.stars,e6=[],n5=0,o6=t53.length;n5<o6;++n5)for(var i4=t53[n5],r6=0,s3=i4.length;r6<s3;r6+=2)e6.push([i4[r6],i4[r6+1]]);return e6},i3.cells=function(){for(var t53=this.stars,e6=[],n5=0,o6=t53.length;n5<o6;++n5)for(var i4=t53[n5],r6=0,s3=i4.length;r6<s3;r6+=2){var a3=i4[r6],c4=i4[r6+1];n5<Math.min(a3,c4)&&e6.push([n5,a3,c4])}return e6}}}),N3=s({"node_modules/robust-in-sphere/in-sphere.js"(t52,e5){var n4=y(),o4=b(),i3=S2(),r5=v3();function s3(t53){return(t53===3?a3:t53===4?c4:t53===5?l4:h6)(o4,i3,n4,r5)}function a3(t53,e6,n5,o6){return function(i4,r6,s4){var a4=n5(i4[0],i4[0]),c5=o6(a4,r6[0]),l5=o6(a4,s4[0]),h7=n5(r6[0],r6[0]),d5=o6(h7,i4[0]),u6=o6(h7,s4[0]),p5=n5(s4[0],s4[0]),m4=o6(p5,i4[0]),g6=o6(p5,r6[0]),f3=t53(e6(g6,u6),e6(d5,c5)),_4=e6(m4,l5),y4=e6(f3,_4);return y4[y4.length-1]}}function c4(t53,e6,n5,o6){return function(i4,r6,s4,a4){var c5=t53(n5(i4[0],i4[0]),n5(i4[1],i4[1])),l5=o6(c5,r6[0]),h7=o6(c5,s4[0]),d5=o6(c5,a4[0]),u6=t53(n5(r6[0],r6[0]),n5(r6[1],r6[1])),p5=o6(u6,i4[0]),m4=o6(u6,s4[0]),g6=o6(u6,a4[0]),f3=t53(n5(s4[0],s4[0]),n5(s4[1],s4[1])),_4=o6(f3,i4[0]),y4=o6(f3,r6[0]),b3=o6(f3,a4[0]),x4=t53(n5(a4[0],a4[0]),n5(a4[1],a4[1])),v4=o6(x4,i4[0]),S3=o6(x4,r6[0]),I4=o6(x4,s4[0]),P4=t53(t53(o6(e6(I4,b3),r6[1]),t53(o6(e6(S3,g6),-s4[1]),o6(e6(y4,m4),a4[1]))),t53(o6(e6(S3,g6),i4[1]),t53(o6(e6(v4,d5),-r6[1]),o6(e6(p5,l5),a4[1])))),M4=t53(t53(o6(e6(I4,b3),i4[1]),t53(o6(e6(v4,d5),-s4[1]),o6(e6(_4,h7),a4[1]))),t53(o6(e6(y4,m4),i4[1]),t53(o6(e6(_4,h7),-r6[1]),o6(e6(p5,l5),s4[1])))),N4=e6(P4,M4);return N4[N4.length-1]}}function l4(t53,e6,n5,o6){return function(i4,r6,s4,a4,c5){var l5=t53(n5(i4[0],i4[0]),t53(n5(i4[1],i4[1]),n5(i4[2],i4[2]))),h7=o6(l5,r6[0]),d5=o6(l5,s4[0]),u6=o6(l5,a4[0]),p5=o6(l5,c5[0]),m4=t53(n5(r6[0],r6[0]),t53(n5(r6[1],r6[1]),n5(r6[2],r6[2]))),g6=o6(m4,i4[0]),f3=o6(m4,s4[0]),_4=o6(m4,a4[0]),y4=o6(m4,c5[0]),b3=t53(n5(s4[0],s4[0]),t53(n5(s4[1],s4[1]),n5(s4[2],s4[2]))),x4=o6(b3,i4[0]),v4=o6(b3,r6[0]),S3=o6(b3,a4[0]),I4=o6(b3,c5[0]),P4=t53(n5(a4[0],a4[0]),t53(n5(a4[1],a4[1]),n5(a4[2],a4[2]))),M4=o6(P4,i4[0]),N4=o6(P4,r6[0]),C4=o6(P4,s4[0]),T4=o6(P4,c5[0]),w4=t53(n5(c5[0],c5[0]),t53(n5(c5[1],c5[1]),n5(c5[2],c5[2]))),R3=o6(w4,i4[0]),E3=o6(w4,r6[0]),A4=o6(w4,s4[0]),O3=o6(w4,a4[0]),L3=t53(t53(t53(o6(t53(o6(e6(O3,T4),s4[1]),t53(o6(e6(A4,I4),-a4[1]),o6(e6(C4,S3),c5[1]))),r6[2]),t53(o6(t53(o6(e6(O3,T4),r6[1]),t53(o6(e6(E3,y4),-a4[1]),o6(e6(N4,_4),c5[1]))),-s4[2]),o6(t53(o6(e6(A4,I4),r6[1]),t53(o6(e6(E3,y4),-s4[1]),o6(e6(v4,f3),c5[1]))),a4[2]))),t53(o6(t53(o6(e6(C4,S3),r6[1]),t53(o6(e6(N4,_4),-s4[1]),o6(e6(v4,f3),a4[1]))),-c5[2]),t53(o6(t53(o6(e6(O3,T4),r6[1]),t53(o6(e6(E3,y4),-a4[1]),o6(e6(N4,_4),c5[1]))),i4[2]),o6(t53(o6(e6(O3,T4),i4[1]),t53(o6(e6(R3,p5),-a4[1]),o6(e6(M4,u6),c5[1]))),-r6[2])))),t53(t53(o6(t53(o6(e6(E3,y4),i4[1]),t53(o6(e6(R3,p5),-r6[1]),o6(e6(g6,h7),c5[1]))),a4[2]),t53(o6(t53(o6(e6(N4,_4),i4[1]),t53(o6(e6(M4,u6),-r6[1]),o6(e6(g6,h7),a4[1]))),-c5[2]),o6(t53(o6(e6(C4,S3),r6[1]),t53(o6(e6(N4,_4),-s4[1]),o6(e6(v4,f3),a4[1]))),i4[2]))),t53(o6(t53(o6(e6(C4,S3),i4[1]),t53(o6(e6(M4,u6),-s4[1]),o6(e6(x4,d5),a4[1]))),-r6[2]),t53(o6(t53(o6(e6(N4,_4),i4[1]),t53(o6(e6(M4,u6),-r6[1]),o6(e6(g6,h7),a4[1]))),s4[2]),o6(t53(o6(e6(v4,f3),i4[1]),t53(o6(e6(x4,d5),-r6[1]),o6(e6(g6,h7),s4[1]))),-a4[2]))))),D4=t53(t53(t53(o6(t53(o6(e6(O3,T4),s4[1]),t53(o6(e6(A4,I4),-a4[1]),o6(e6(C4,S3),c5[1]))),i4[2]),o6(t53(o6(e6(O3,T4),i4[1]),t53(o6(e6(R3,p5),-a4[1]),o6(e6(M4,u6),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(A4,I4),i4[1]),t53(o6(e6(R3,p5),-s4[1]),o6(e6(x4,d5),c5[1]))),a4[2]),o6(t53(o6(e6(C4,S3),i4[1]),t53(o6(e6(M4,u6),-s4[1]),o6(e6(x4,d5),a4[1]))),-c5[2]))),t53(t53(o6(t53(o6(e6(A4,I4),r6[1]),t53(o6(e6(E3,y4),-s4[1]),o6(e6(v4,f3),c5[1]))),i4[2]),o6(t53(o6(e6(A4,I4),i4[1]),t53(o6(e6(R3,p5),-s4[1]),o6(e6(x4,d5),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(E3,y4),i4[1]),t53(o6(e6(R3,p5),-r6[1]),o6(e6(g6,h7),c5[1]))),s4[2]),o6(t53(o6(e6(v4,f3),i4[1]),t53(o6(e6(x4,d5),-r6[1]),o6(e6(g6,h7),s4[1]))),-c5[2])))),k4=e6(L3,D4);return k4[k4.length-1]}}function h6(t53,e6,n5,o6){return function(i4,r6,s4,a4,c5,l5){var h7=t53(t53(n5(i4[0],i4[0]),n5(i4[1],i4[1])),t53(n5(i4[2],i4[2]),n5(i4[3],i4[3]))),d5=o6(h7,r6[0]),u6=o6(h7,s4[0]),p5=o6(h7,a4[0]),m4=o6(h7,c5[0]),g6=o6(h7,l5[0]),f3=t53(t53(n5(r6[0],r6[0]),n5(r6[1],r6[1])),t53(n5(r6[2],r6[2]),n5(r6[3],r6[3]))),_4=o6(f3,i4[0]),y4=o6(f3,s4[0]),b3=o6(f3,a4[0]),x4=o6(f3,c5[0]),v4=o6(f3,l5[0]),S3=t53(t53(n5(s4[0],s4[0]),n5(s4[1],s4[1])),t53(n5(s4[2],s4[2]),n5(s4[3],s4[3]))),I4=o6(S3,i4[0]),P4=o6(S3,r6[0]),M4=o6(S3,a4[0]),N4=o6(S3,c5[0]),C4=o6(S3,l5[0]),T4=t53(t53(n5(a4[0],a4[0]),n5(a4[1],a4[1])),t53(n5(a4[2],a4[2]),n5(a4[3],a4[3]))),w4=o6(T4,i4[0]),R3=o6(T4,r6[0]),E3=o6(T4,s4[0]),A4=o6(T4,c5[0]),O3=o6(T4,l5[0]),L3=t53(t53(n5(c5[0],c5[0]),n5(c5[1],c5[1])),t53(n5(c5[2],c5[2]),n5(c5[3],c5[3]))),D4=o6(L3,i4[0]),k4=o6(L3,r6[0]),z4=o6(L3,s4[0]),j4=o6(L3,a4[0]),F4=o6(L3,l5[0]),$5=t53(t53(n5(l5[0],l5[0]),n5(l5[1],l5[1])),t53(n5(l5[2],l5[2]),n5(l5[3],l5[3]))),B4=o6($5,i4[0]),Y4=o6($5,r6[0]),X4=o6($5,s4[0]),H4=o6($5,a4[0]),W5=o6($5,c5[0]),V4=t53(t53(t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),s4[2]),o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),-l5[2]))),r6[3]),t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),r6[2]),o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),-l5[2]))),-s4[3]),o6(t53(t53(o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),r6[2]),o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),c5[2]),o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),-l5[2]))),a4[3]))),t53(t53(o6(t53(t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),r6[2]),o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),-l5[2]))),-c5[3]),o6(t53(t53(o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),r6[2]),o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),-c5[2]))),l5[3])),t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),r6[2]),o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),-l5[2]))),i4[3]),o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-l5[2]))),-r6[3])))),t53(t53(t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),c5[2]),o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),-l5[2]))),a4[3]),o6(t53(t53(o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),i4[2]),o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),a4[2]),o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),-l5[2]))),-c5[3])),t53(o6(t53(t53(o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),i4[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),a4[2]),o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),-c5[2]))),l5[3]),o6(t53(t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),r6[2]),o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),-l5[2]))),i4[3]))),t53(t53(o6(t53(t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),i4[2]),o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-l5[2]))),-r6[3]),o6(t53(t53(o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),i4[2]),o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),a4[2]),o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),-l5[2]))),s4[3])),t53(o6(t53(t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),i4[2]),o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-l5[2]))),-a4[3]),o6(t53(t53(o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),i4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-r6[2])),t53(o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-a4[2]))),l5[3]))))),U3=t53(t53(t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),s4[2]),o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),-l5[2]))),i4[3]),t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-l5[2]))),-s4[3]),o6(t53(t53(o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),c5[2]),o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),-l5[2]))),a4[3]))),t53(t53(o6(t53(t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),i4[2]),o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-l5[2]))),-c5[3]),o6(t53(t53(o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),i4[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-c5[2]))),l5[3])),t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),r6[2]),o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),c5[2]),o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),-l5[2]))),i4[3]),o6(t53(t53(o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),c5[2]),o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),-l5[2]))),-r6[3])))),t53(t53(t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),c5[2]),o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),-l5[2]))),s4[3]),o6(t53(t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),i4[2]),o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-l5[2]))),-c5[3])),t53(o6(t53(t53(o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),i4[2]),o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-c5[2]))),l5[3]),o6(t53(t53(o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),r6[2]),o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),-c5[2]))),i4[3]))),t53(t53(o6(t53(t53(o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),i4[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-c5[2]))),-r6[3]),o6(t53(t53(o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),i4[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),a4[2]),o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),-c5[2]))),s4[3])),t53(o6(t53(t53(o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),i4[2]),o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-c5[2]))),-a4[3]),o6(t53(t53(o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),i4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-r6[2])),t53(o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-a4[2]))),c5[3]))))),Z3=e6(V4,U3);return Z3[Z3.length-1]}}var d4=[function(){return 0},function(){return 0},function(){return 0}];function u5(t53){var e6=d4[t53.length];return e6||(e6=d4[t53.length]=s3(t53.length)),e6.apply(void 0,t53)}function p4(t53,e6,n5,o6,i4,r6,s4,a4){return function(e7,n6,c5,l5,h7,d5){switch(arguments.length){case 0:case 1:return 0;case 2:return o6(e7,n6);case 3:return i4(e7,n6,c5);case 4:return r6(e7,n6,c5,l5);case 5:return s4(e7,n6,c5,l5,h7);case 6:return a4(e7,n6,c5,l5,h7,d5)}for(var u6=new Array(arguments.length),p5=0;p5<arguments.length;++p5)u6[p5]=arguments[p5];return t53(u6)}}(function(){for(;d4.length<=6;)d4.push(s3(d4.length));e5.exports=p4.apply(void 0,[u5].concat(d4));for(var t53=0;t53<=6;++t53)e5.exports[t53]=d4[t53]})()}}),C3=s({"node_modules/cdt2d/lib/delaunay.js"(t52,e5){var n4=N3()[4];_3();function o4(t53,e6,o6,i3,r5,s3){var a3=e6.opposite(i3,r5);if(!(a3<0)){if(r5<i3){var c4=i3;i3=r5,r5=c4,c4=s3,s3=a3,a3=c4}e6.isConstraint(i3,r5)||n4(t53[i3],t53[r5],t53[s3],t53[a3])<0&&o6.push(i3,r5)}}e5.exports=function(t53,e6){for(var i3=[],r5=t53.length,s3=e6.stars,a3=0;a3<r5;++a3)for(var c4=s3[a3],l4=1;l4<c4.length;l4+=2)if(!((p4=c4[l4])<a3)&&!e6.isConstraint(a3,p4)){for(var h6=c4[l4-1],d4=-1,u5=1;u5<c4.length;u5+=2)if(c4[u5-1]===p4){d4=c4[u5];break}d4<0||n4(t53[a3],t53[p4],t53[h6],t53[d4])<0&&i3.push(a3,p4)}for(;i3.length>0;){for(var p4=i3.pop(),m4=(h6=-1,d4=-1,c4=s3[a3=i3.pop()],1);m4<c4.length;m4+=2){var g6=c4[m4-1],f3=c4[m4];g6===p4?d4=f3:f3===p4&&(h6=g6)}h6<0||d4<0||n4(t53[a3],t53[p4],t53[h6],t53[d4])>=0||(e6.flip(a3,p4),o4(t53,e6,i3,h6,a3,d4),o4(t53,e6,i3,a3,d4,h6),o4(t53,e6,i3,d4,p4,h6),o4(t53,e6,i3,p4,h6,d4))}}}}),T3=s({"node_modules/cdt2d/lib/filter.js"(t52,e5){var n4=_3();function o4(t53,e6,n5,o6,i4,r5,s3){this.cells=t53,this.neighbor=e6,this.flags=o6,this.constraint=n5,this.active=i4,this.next=r5,this.boundary=s3}function i3(t53,e6){return t53[0]-e6[0]||t53[1]-e6[1]||t53[2]-e6[2]}e5.exports=function(t53,e6,n5){var r5=(function(t54,e7){for(var n6=t54.cells(),r6=n6.length,s4=0;s4<r6;++s4){var a4=(_5=n6[s4])[0],c5=_5[1],l5=_5[2];c5<l5?c5<a4&&(_5[0]=c5,_5[1]=l5,_5[2]=a4):l5<a4&&(_5[0]=l5,_5[1]=a4,_5[2]=c5)}n6.sort(i3);var h7=new Array(r6);for(s4=0;s4<h7.length;++s4)h7[s4]=0;var d5=[],u6=[],p5=new Array(3*r6),m6=new Array(3*r6),g7=null;e7&&(g7=[]);var f4=new o4(n6,p5,m6,h7,d5,u6,g7);for(s4=0;s4<r6;++s4)for(var _5=n6[s4],y4=0;y4<3;++y4){a4=_5[y4],c5=_5[(y4+1)%3];var b3=p5[3*s4+y4]=f4.locate(c5,a4,t54.opposite(c5,a4)),x4=m6[3*s4+y4]=t54.isConstraint(a4,c5);b3<0&&(x4?u6.push(s4):(d5.push(s4),h7[s4]=1),e7&&g7.push([c5,a4,-1]))}return f4})(t53,n5);if(e6===0)return n5?r5.cells.concat(r5.boundary):r5.cells;for(var s3=1,a3=r5.active,c4=r5.next,l4=r5.flags,h6=r5.cells,d4=r5.constraint,u5=r5.neighbor;a3.length>0||c4.length>0;){for(;a3.length>0;){var p4=a3.pop();if(l4[p4]!==-s3){l4[p4]=s3,h6[p4];for(var m4=0;m4<3;++m4){var g6=u5[3*p4+m4];g6>=0&&l4[g6]===0&&(d4[3*p4+m4]?c4.push(g6):(a3.push(g6),l4[g6]=s3))}}}var f3=c4;c4=a3,a3=f3,c4.length=0,s3=-s3}var _4=(function(t54,e7,n6){for(var o6=0,i4=0;i4<t54.length;++i4)e7[i4]===n6&&(t54[o6++]=t54[i4]);return t54.length=o6,t54})(h6,l4,e6);return n5?_4.concat(r5.boundary):_4},o4.prototype.locate=(function(){var t53=[0,0,0];return function(e6,o6,r5){var s3=e6,a3=o6,c4=r5;return o6<r5?o6<e6&&(s3=o6,a3=r5,c4=e6):r5<e6&&(s3=r5,a3=e6,c4=o6),s3<0?-1:(t53[0]=s3,t53[1]=a3,t53[2]=c4,n4.eq(this.cells,t53,i3))}})()}}),w3=s({"node_modules/cdt2d/cdt2d.js"(t52,e5){var n4=P2(),o4=M3(),i3=C3(),r5=T3();function s3(t53){return[Math.min(t53[0],t53[1]),Math.max(t53[0],t53[1])]}function a3(t53,e6){return t53[0]-e6[0]||t53[1]-e6[1]}function c4(t53,e6,n5){return e6 in t53?t53[e6]:n5}e5.exports=function(t53,e6,l4){Array.isArray(e6)?(l4=l4||{},e6=e6||[]):(l4=e6||{},e6=[]);var h6=!!c4(l4,"delaunay",!0),d4=!!c4(l4,"interior",!0),u5=!!c4(l4,"exterior",!0),p4=!!c4(l4,"infinity",!1);if(!d4&&!u5||t53.length===0)return[];var m4=n4(t53,e6);if(h6||d4!==u5||p4){for(var g6=o4(t53.length,(function(t54){return t54.map(s3).sort(a3)})(e6)),f3=0;f3<m4.length;++f3){var _4=m4[f3];g6.addTriangle(_4[0],_4[1],_4[2])}return h6&&i3(t53,g6),u5?d4?p4?r5(g6,0,p4):g6.cells():r5(g6,1,p4):r5(g6,-1)}return m4}}}),R2={0:"M0.301025 0.257813 L0.206593 0.283385 L0.122042 0.361307 L0.075923 0.474441 L0.064942 0.642221 L0.091296 0.78289 L0.159376 0.899463 L0.257104 0.961214 L0.344948 0.961214 L0.442678 0.899463 L0.510757 0.78289 L0.537111 0.642221 L0.526131 0.474441 L0.480012 0.361307 L0.39546 0.283385 L0.301025 0.257813",1:"M0.220426 0.40845 L0.381626 0.270996 L0.381626 0.948966",2:"M0.110409 0.39212 L0.125621 0.342293 L0.170571 0.295823 L0.244237 0.26431 L0.291518 0.257813 L0.373319 0.263799 L0.434683 0.290705 L0.468239 0.331966 L0.480292 0.379913 L0.479492 0.411806 L0.465088 0.465192 L0.402571 0.568988 L0.245134 0.766438 L0.07959 0.948045 L0.522462 0.948045",3:"M0.081606 0.345073 L0.119154 0.315633 L0.178996 0.284091 L0.255265 0.257813 L0.349133 0.263062 L0.43127 0.289348 L0.48994 0.336662 L0.525141 0.394491 L0.513407 0.457577 L0.466472 0.504892 L0.384334 0.541692 L0.290464 0.56272 L0.20833 0.573235 L0.290464 0.583749 L0.384334 0.610035 L0.466472 0.652092 L0.519274 0.709922 L0.531007 0.773007 L0.50754 0.841351 L0.454738 0.899179 L0.3726 0.946494 L0.310412 0.961214 L0.209503 0.959111 L0.127367 0.946494 L0.071046 0.929671",4:"M0.418494 0.270996 L0.048828 0.724199 L0.553224 0.724199 M0.414181 0.578167 L0.414181 0.94897",5:"M0.074951 0.270996 L0.074951 0.614701 L0.267655 0.5695 L0.405247 0.586502 L0.460002 0.617189 L0.498028 0.660731 L0.527101 0.779401 L0.513352 0.841049 L0.477274 0.889568 L0.406378 0.93463 L0.324445 0.958337 L0.247399 0.962139 L0.182516 0.949767 L0.130068 0.925508 L0.074951 0.875607 M0.074951 0.270996 L0.527101 0.270996",6:"M0.428549 0.257813 L0.341433 0.285053 L0.26073 0.312099 L0.192188 0.360182 L0.138902 0.410969 L0.098219 0.500422 L0.070249 0.584267 L0.067264 0.670716 L0.065164 0.756863 L0.087163 0.820973 L0.108168 0.861042 L0.157916 0.913131 L0.210981 0.948192 L0.29279 0.961214 L0.384548 0.956206 L0.456409 0.924151 L0.507262 0.881077 L0.5349 0.821975 L0.537111 0.771889 L0.521634 0.718798 L0.498418 0.67372 L0.463042 0.636657 L0.414398 0.613617 L0.34696 0.598591 L0.28284 0.595587 L0.215403 0.605604 L0.145756 0.641665 L0.109274 0.678729 L0.064942 0.724006",7:"M0.071534 0.270996 L0.530519 0.270996 L0.495935 0.291702 L0.477752 0.305407 L0.435186 0.346112 L0.412067 0.374136 L0.388565 0.40796 L0.365315 0.448098 L0.342943 0.495062 L0.322081 0.549366 L0.303364 0.611524 L0.287416 0.68205 L0.270077 0.80465 L0.26253 0.94897",8:"M0.286761 0.257813 L0.210684 0.27162 L0.1414 0.305622 L0.092494 0.382125 L0.111513 0.450128 L0.16857 0.502193 L0.228345 0.539382 L0.377781 0.594635 L0.470161 0.645637 L0.52586 0.706203 L0.538087 0.792269 L0.506841 0.87621 L0.438915 0.927212 L0.339743 0.961214 L0.263666 0.959089 L0.174004 0.929337 L0.102003 0.881523 L0.063965 0.811395 L0.066682 0.741266 L0.102003 0.671139 L0.180797 0.608448 L0.259591 0.580822 L0.358762 0.548945 L0.456576 0.49688 L0.486463 0.446941 L0.487822 0.362999 L0.453859 0.302434 L0.384574 0.265245 L0.286761 0.257813",9:"M0.511026 0.437812 L0.491026 0.347812 L0.451026 0.297812 L0.391026 0.267812 L0.311026 0.257813 L0.231026 0.267812 L0.161026 0.297812 L0.111026 0.347812 L0.091026 0.417812 L0.111026 0.487812 L0.161026 0.537812 L0.231026 0.567812 L0.311026 0.577812 L0.391026 0.557812 L0.451026 0.517812 L0.491026 0.477812 L0.511026 0.437812 M0.510026 0.438812 L0.434026 0.636812 L0.381026 0.777812 L0.337026 0.879812 L0.301026 0.957812","!":"M0.301026 0.270996 L0.301026 0.749566 M0.251466 0.94897 L0.350587 0.94897",'"':"M0.16504 0.270996 L0.16504 0.523022 M0.437013 0.270996 L0.437013 0.523022","#":"M0.20958 0.282227 L0.146515 0.949754 M0.461844 0.282227 L0.398779 0.949754 M0.032999 0.526969 L0.600587 0.452796 M0.001465 0.82366 L0.569055 0.749486",$:"M0.307121 0.240234 L0.307121 1.083502 M0.490031 0.415915 L0.404676 0.328075 L0.23396 0.310507 L0.136407 0.398347 L0.099828 0.521324 L0.124213 0.591596 L0.197379 0.644299 L0.429061 0.697003 L0.502224 0.749708 L0.526613 0.837547 L0.477836 0.960526 L0.355897 1.013228 L0.197379 0.99566 L0.112021 0.942957 L0.07544 0.837547","'":"M0.301026 0.270996 L0.301026 0.523022","(":"M0.413087 0.241211 L0.372337 0.28347 L0.331589 0.334184 L0.290838 0.393349 L0.25009 0.460965 L0.219528 0.528584 L0.199153 0.5962 L0.188966 0.655364 L0.199153 0.714529 L0.219528 0.782146 L0.25009 0.849764 L0.290838 0.91738 L0.331589 0.976544 L0.372337 1.027258 L0.413087 1.069491",")":"M0.188966 0.241211 L0.229716 0.28347 L0.270466 0.334184 L0.311213 0.393349 L0.351964 0.460965 L0.382526 0.528584 L0.4029 0.5962 L0.413087 0.655364 L0.4029 0.714529 L0.382526 0.782146 L0.351964 0.849764 L0.311213 0.91738 L0.270466 0.976544 L0.229716 1.027258 L0.188966 1.069491","*":"M0.301026 0.458702 L0.301026 0.681942 M0.301026 0.458702 L0.520997 0.536834 M0.301026 0.458702 L0.439954 0.257813 M0.301026 0.458702 L0.162098 0.257813 M0.301026 0.458702 L0.081055 0.536834","+":"M0.042969 0.66845 L0.559083 0.66845 M0.301023 0.428223 L0.301023 0.908661",",":"M0.38672 0.852051 L0.215333 1.030661 L0.301025 1.119971","-":"M0.173829 0.686035 L0.428224 0.686035",".":"M0.362549 0.851074 L0.239503 0.851074","/":"M0.062501 1.035249 L0.539551 0.270996","<":"M0.559083 0.441895 L0.042969 0.66939 L0.042969 0.66939 L0.559083 0.896902","=":"M0.042969 0.545898 L0.559083 0.545898 M0.042969 0.80837 L0.559083 0.80837",">":"M0.042969 0.441895 L0.559083 0.66939 L0.559083 0.66939 L0.042969 0.896902",A:"M0.018067 0.94897 L0.290179 0.270996 L0.583986 0.94897 M0.155303 0.684521 L0.433548 0.684521",B:"M0.063965 0.94897 L0.063965 0.278953 L0.209356 0.270996 L0.342486 0.294394 L0.432179 0.37292 L0.418224 0.48773 L0.312686 0.549166 L0.084728 0.575531 L0.306377 0.589434 L0.468877 0.647456 L0.538087 0.736658 L0.5324 0.85202 L0.501247 0.902983 L0.42355 0.944398 L0.063965 0.94897",C:"M0.529054 0.419847 L0.498425 0.345196 L0.442238 0.292341 L0.33583 0.257813 L0.257199 0.268357 L0.187906 0.303748 L0.120243 0.385432 L0.072998 0.599844 L0.110073 0.815385 L0.165381 0.902183 L0.222883 0.942801 L0.334904 0.961214 L0.43253 0.937679 L0.504816 0.868999 L0.529054 0.772065",D:"M0.064454 0.94897 L0.071838 0.285078 L0.171217 0.270996 L0.247348 0.272633 L0.37101 0.306078 L0.462461 0.378304 L0.514748 0.475555 L0.535591 0.576392 L0.537599 0.652313 L0.528065 0.717381 L0.508562 0.772419 L0.445948 0.855695 L0.362356 0.90871 L0.225203 0.945862 L0.064454 0.94897",E:"M0.080078 0.270996 L0.080078 0.94897 M0.080078 0.270996 L0.521974 0.270996 M0.080078 0.609981 L0.389405 0.609981 M0.080078 0.94897 L0.521974 0.94897",F:"M0.086426 0.270996 L0.086426 0.94897 M0.091304 0.275607 L0.515626 0.275607 M0.091304 0.607677 L0.447344 0.607677",G:"M0.498034 0.284943 L0.374621 0.257813 L0.244219 0.268648 L0.160577 0.311997 L0.094556 0.398116 L0.056397 0.58404 L0.076752 0.785532 L0.120865 0.858197 L0.188947 0.916734 L0.271008 0.953591 L0.357069 0.961214 L0.43715 0.932047 L0.501262 0.858539 L0.545656 0.648611 L0.329595 0.648131",H:"M0.066895 0.270996 L0.066895 0.94897 M0.066895 0.595658 L0.530009 0.595658 M0.535157 0.270996 L0.535157 0.94897",I:"M0.301026 0.270996 L0.301026 0.94897",J:"M0.506839 0.270996 L0.507814 0.782193 L0.498468 0.846168 L0.480733 0.880789 L0.455864 0.90832 L0.426095 0.929408 L0.360746 0.954812 L0.302508 0.962139 L0.223573 0.953638 L0.16538 0.930312 L0.137072 0.907715 L0.116428 0.880312 L0.102822 0.848819 L0.095633 0.813947 L0.094239 0.776413",K:"M0.035401 0.270996 L0.035401 0.94897 M0.502258 0.316194 L0.035401 0.687823 M0.212484 0.582361 L0.566652 0.933903",L:"M0.07544 0.270996 L0.07544 0.94897 L0.526613 0.94897",M:"M0.042481 0.94897 L0.042481 0.270996 L0.301027 0.712492 L0.559571 0.270996 L0.559571 0.94897",N:"M0.067871 0.94897 L0.067871 0.270996 L0.534181 0.94897 L0.525031 0.270996",O:"M0.287293 0.961214 L0.19843 0.933567 L0.1172 0.849451 L0.057129 0.563945 L0.114348 0.350255 L0.18455 0.289392 L0.306101 0.257813 L0.42054 0.29572 L0.487543 0.365003 L0.544923 0.625294 L0.516366 0.789624 L0.465476 0.884596 L0.375084 0.949287 L0.287293 0.961214",P:"M0.070557 0.94897 L0.070557 0.28379 L0.20704 0.270996 L0.329134 0.278993 L0.408525 0.300514 L0.444022 0.317908 L0.500637 0.368929 L0.525796 0.423728 L0.531496 0.50384 L0.508934 0.554205 L0.473724 0.582043 L0.417577 0.604365 L0.336375 0.620372 L0.226014 0.629268 L0.082368 0.630258",Q:"M0.282435 1.050813 L0.195447 1.019646 L0.115933 0.924817 L0.057129 0.602943 L0.113139 0.362034 L0.18186 0.293418 L0.300844 0.257813 L0.412868 0.300553 L0.478457 0.37866 L0.534625 0.672103 L0.506671 0.857367 L0.456855 0.964437 L0.368371 1.037368 L0.282435 1.050813 M0.341225 0.815559 L0.544923 1.070653",R:"M0.034912 0.944112 L0.034912 0.288556 L0.227127 0.270996 L0.362038 0.276867 L0.443423 0.294907 L0.477644 0.309614 L0.505809 0.328757 L0.526616 0.352817 L0.544963 0.418061 L0.543241 0.475921 L0.524463 0.517817 L0.49076 0.546518 L0.444265 0.564799 L0.355195 0.578739 L0.047653 0.589627 M0.303054 0.617306 L0.56714 0.94897",S:"M0.483037 0.364333 L0.407613 0.267477 L0.22883 0.257813 L0.128623 0.327565 L0.087712 0.455539 L0.104656 0.518727 L0.168054 0.573307 L0.41928 0.617318 L0.503796 0.669342 L0.535157 0.759324 L0.493846 0.900055 L0.367668 0.961214 L0.205436 0.956661 L0.116711 0.907038 L0.066895 0.790334",T:"M0.022949 0.270996 L0.579103 0.270996 M0.309284 0.270996 L0.309284 0.94897",U:"M0.072022 0.270996 L0.07308 0.648875 L0.080372 0.75167 L0.099024 0.827813 L0.134786 0.885729 L0.181571 0.924023 L0.251464 0.95168 L0.339655 0.962139 L0.401553 0.951668 L0.45232 0.924086 L0.482701 0.891771 L0.495745 0.870529 L0.515699 0.81637 L0.525014 0.744626 L0.530031 0.272017",V:"M0.027832 0.270996 L0.320083 0.94897 L0.57422 0.270996",W:"M0 0.270996 L0.079799 0.940377 L0.285198 0.472884 L0.505255 0.94897 L0.602052 0.270996",X:"M0.009034 0.270996 L0.586805 0.94897 M0.593019 0.270996 L0.015246 0.94897",Y:"M0.018067 0.270996 L0.293132 0.574135 M0.583986 0.271959 L0.294954 0.57606 L0.305277 0.94897",Z:"M0.053711 0.270996 L0.548341 0.270996 L0.053711 0.94897 L0.548341 0.94897","[":"M0.404542 0.240234 L0.197511 0.240234 L0.197511 1.069424 L0.404542 1.069424","\\":"M0.062501 0.270996 L0.539551 1.035249","]":"M0.19751 0.240234 L0.404542 0.240234 L0.404542 1.069424 L0.19751 1.069424","^":"M0.035156 0.523931 L0.301024 0.270996 L0.566896 0.523931",_:"M0 1.160601 L0.602052 1.160601",a:"M0.527101 0.439941 L0.527101 0.973965 M0.527101 0.553824 L0.451366 0.477535 L0.376759 0.439941 L0.263722 0.439941 L0.187989 0.477535 L0.112255 0.553824 L0.074951 0.66881 L0.074951 0.745099 L0.112255 0.85898 L0.187989 0.93527 L0.263722 0.973965 L0.376759 0.973965 L0.451366 0.93527 L0.527101 0.85898",b:"M0.07666 0.240234 L0.07666 0.959985 M0.07666 0.582737 L0.151822 0.514237 L0.225865 0.480483 L0.338045 0.480483 L0.413211 0.514237 L0.488374 0.582737 L0.525392 0.685983 L0.525392 0.754485 L0.488374 0.856739 L0.413211 0.92524 L0.338045 0.959985 L0.225865 0.959985 L0.151822 0.92524 L0.07666 0.856739",c:"M0.512452 0.553823 L0.441624 0.477535 L0.371854 0.439941 L0.26614 0.439941 L0.195312 0.477535 L0.124486 0.553823 L0.0896 0.668808 L0.0896 0.745099 L0.124486 0.858979 L0.195312 0.93527 L0.26614 0.973965 L0.371854 0.973965 L0.441624 0.93527 L0.512452 0.858979",d:"M0.525392 0.240234 L0.525392 0.959985 M0.525392 0.582737 L0.450232 0.514237 L0.376189 0.480483 L0.264006 0.480483 L0.188844 0.514237 L0.11368 0.582737 L0.076661 0.685983 L0.076661 0.754485 L0.11368 0.856739 L0.188844 0.92524 L0.264006 0.959985 L0.376189 0.959985 L0.450232 0.92524 L0.525392 0.856739",e:"M0.059571 0.668808 L0.542482 0.668808 M0.542482 0.592521 L0.502641 0.516231 L0.461594 0.477535 L0.381914 0.439941 L0.261186 0.439941 L0.180299 0.477535 L0.099412 0.553823 L0.059571 0.668808 L0.059571 0.745099 L0.099412 0.858979 L0.180299 0.93527 L0.261186 0.973965 L0.381914 0.973965 L0.461594 0.93527 L0.542482 0.858979",f:"M0.512941 0.240234 L0.406984 0.240234 L0.301026 0.274346 L0.248047 0.374731 L0.248047 0.946817 M0.089112 0.476088 L0.459965 0.476088",g:"M0.525392 0.439941 L0.525392 0.989395 L0.488373 1.091918 L0.45023 1.126757 L0.376189 1.160601 L0.264004 1.160601 L0.188844 1.126757 L0.113681 1.058075 L0.076661 0.954555 M0.525392 0.542467 L0.45023 0.473786 L0.376189 0.439941 L0.264004 0.439941 L0.188844 0.473786 L0.113681 0.542467 L0.076661 0.645988 L0.076661 0.714669 L0.113681 0.817193 L0.188844 0.885875 L0.264004 0.920713 L0.376189 0.920713 L0.45023 0.885875 L0.525392 0.817193",h:"M0.092041 0.240234 L0.092041 0.946817 M0.092041 0.61058 L0.205937 0.509225 L0.282214 0.476086 L0.396109 0.476086 L0.47187 0.509225 L0.510011 0.61058 L0.510011 0.946817",i:"M0.261026 0.240234 L0.341026 0.240234 M0.300978 0.476089 L0.300978 0.946817",j:"M0.3853 0.240234 L0.447023 0.240234 M0.416159 0.465708 L0.416159 1.011689 L0.383887 1.108586 L0.252832 1.140264 L0.15503 1.108586",k:"M0.065186 0.240234 L0.065186 0.946817 M0.493824 0.476086 L0.065186 0.812323 M0.236758 0.677829 L0.536867 0.946817",l:"M0.301026 0.234863 L0.301026 0.946441",m:"M0.050538 0.439941 L0.050538 0.960796 M0.050538 0.588758 L0.114405 0.476607 L0.157178 0.439941 L0.236864 0.439941 L0.279637 0.476607 L0.32241 0.588758 L0.32241 0.960796 M0.32241 0.588758 L0.386281 0.476607 L0.428467 0.439941 L0.50874 0.439941 L0.551515 0.476607 L0.551515 0.960796",n:"M0.092041 0.439941 L0.092041 0.960796 M0.092041 0.588758 L0.205936 0.476607 L0.282216 0.439941 L0.396113 0.439941 L0.471871 0.476607 L0.510011 0.588758 L0.510011 0.960796",o:"M0.247175 0.439941 L0.175178 0.477535 L0.103186 0.553823 L0.066895 0.668808 L0.066895 0.745099 L0.103186 0.858979 L0.175178 0.93527 L0.247175 0.973965 L0.354874 0.973965 L0.426872 0.93527 L0.498866 0.858979 L0.535157 0.745099 L0.535157 0.668808 L0.498866 0.553823 L0.426872 0.477535 L0.354874 0.439941 L0.247175 0.439941",p:"M0.076904 0.439941 L0.076904 1.154244 M0.076904 0.541563 L0.151986 0.473487 L0.225944 0.439941 L0.338005 0.439941 L0.413087 0.473487 L0.488166 0.541563 L0.525148 0.644169 L0.525148 0.712246 L0.488166 0.813866 L0.413087 0.881942 L0.338005 0.916471 L0.225944 0.916471 L0.151986 0.881942 L0.076904 0.813866",q:"M0.525148 0.441895 L0.525148 1.156195 M0.525148 0.5435 L0.450067 0.47544 L0.376106 0.441895 L0.264042 0.441895 L0.188966 0.47544 L0.113885 0.5435 L0.076905 0.646108 L0.076905 0.714187 L0.113885 0.815809 L0.188966 0.883886 L0.264042 0.918418 L0.376106 0.918418 L0.450067 0.883886 L0.525148 0.815809",r:"M0.107422 0.439941 L0.107422 0.960796 M0.107422 0.663164 L0.155824 0.551014 L0.252626 0.476607 L0.349428 0.439941 L0.49463 0.439941",s:"M0.475556 0.477535 L0.400757 0.439941 L0.276092 0.439941 L0.176361 0.477535 L0.101563 0.553823 L0.101563 0.630112 L0.176361 0.668808 L0.301024 0.668808 L0.425688 0.745099 L0.50049 0.821387 L0.50049 0.897677 L0.425688 0.93527 L0.325956 0.973965 L0.201295 0.973965 L0.126496 0.93527 L0.101563 0.858979",t:"M0.246032 0.297852 L0.246032 0.826549 L0.301023 0.919323 L0.411011 0.950848 L0.520997 0.950848 M0.081055 0.515799 L0.466004 0.515799",u:"M0.092041 0.454102 L0.092041 0.826134 L0.13018 0.937211 L0.205936 0.974954 L0.319832 0.974954 L0.396113 0.937211 L0.510011 0.826134 M0.510011 0.454102 L0.510011 0.974954",v:"M0.048828 0.453125 L0.301026 0.961719 M0.553224 0.453125 L0.301026 0.961719",w:"M0 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.451539 0.961719 M0.602052 0.453125 L0.451539 0.961719",x:"M0.03711 0.453125 L0.564943 0.961719 M0.564943 0.453125 L0.03711 0.961719",y:"M0.084618 0.453125 L0.320232 0.921476 M0.55713 0.453125 L0.320232 0.921476 L0.242119 1.055289 L0.163369 1.122196 L0.084618 1.155166 L0.044922 1.155166",z:"M0.505373 0.452148 L0.09668 0.961651 M0.09668 0.452148 L0.505373 0.452148 M0.09668 0.961651 L0.505373 0.961651"},E2={};for(let t52 in R2){E2[t52]=[];let e5=R2[t52].split("M").slice(1).map(t53=>t53.split("L").map(t54=>t54.trim().split(" ").map(parseFloat)));for(let n4 of e5)for(let e6=0;e6<n4.length-1;e6++)E2[t52].push({x1:n4[e6][0],y1:1-n4[e6][1],x2:n4[e6+1][0],y2:1-n4[e6+1][1]})}new TextEncoder,(()=>{let t52=new Uint8Array(4);new Uint32Array(t52.buffer)[0]=1,t52[0]})(),globalThis.Int8Array,globalThis.Uint8Array,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.BigUint64Array,globalThis.BigInt64Array,globalThis.Float32Array,globalThis.Float64Array;var A3=[];for(let t52=0;t52<256;t52++){let e5=t52;for(let t53=0;t53<8;t53++)1&e5?e5=3988292384^e5>>>1:e5>>>=1;A3[t52]=e5}var O2=new Uint16Array([255]),L2=(new Uint8Array(O2.buffer)[0],new Uint16Array([255]));new Uint8Array(L2.buffer)[0],new Uint8Array(0),Uint8Array.of(137,80,78,71,13,10,26,10),new TextDecoder("latin1");function D3(){return D3=Object.assign?Object.assign.bind():function(t52){for(var e5=1;e5<arguments.length;e5++){var n4=arguments[e5];for(var o4 in n4)({}).hasOwnProperty.call(n4,o4)&&(t52[o4]=n4[o4])}return t52},D3.apply(null,arguments)}function k3(t52,e5){return(k3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t53,e6){return t53.__proto__=e6,t53})(t52,e5)}function z3(t52){return(z3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t53){return t53.__proto__||Object.getPrototypeOf(t53)})(t52)}function j2(){try{var t52=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(j2=function(){return!!t52})()}function F3(t52){var e5=typeof Map=="function"?new Map:void 0;return F3=function(t53){if(t53===null||!(function(t54){try{return Function.toString.call(t54).indexOf("[native code]")!==-1}catch{return typeof t54=="function"}})(t53))return t53;if(typeof t53!="function")throw new TypeError("Super expression must either be null or a function");if(e5!==void 0){if(e5.has(t53))return e5.get(t53);e5.set(t53,n4)}function n4(){return(function(t54,e6,n5){if(j2())return Reflect.construct.apply(null,arguments);var o4=[null];o4.push.apply(o4,e6);var i3=new(t54.bind.apply(t54,o4));return n5&&k3(i3,n5.prototype),i3})(t53,arguments,z3(this).constructor)}return n4.prototype=Object.create(t53.prototype,{constructor:{value:n4,enumerable:!1,writable:!0,configurable:!0}}),k3(n4,t53)},F3(t52)}var $4={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
|
|
338
|
+
`)?.every(str2=>str2.includes("LINESTRING"))}function isWktString(str){return str.startsWith("POINT")||isArrayOfPoints(str)||str.startsWith("LINESTRING")||isArrayOfLines(str)||str.startsWith("MULTILINESTRING")||str.startsWith("POLYGON")||str.startsWith("MULTIPOINT")||str.startsWith("MULTIPOLYGON")||str.startsWith("GEOMETRYCOLLECTION")}Flatten.isWktString=isWktString;Flatten.parseWKT=parseWKT;Flatten.BooleanOperations=BooleanOperations;Flatten.Relations=Relations;init_dist();init_dist5();var package_default={name:"@tscircuit/capacity-autorouter",main:"./dist/index.js",version:"0.0.505",type:"module",files:["dist"],scripts:{start:"cosmos",build:"tsup ./lib/index.ts --minify terser --external @tscircuit/core --external circuit-to-svg --format esm --dts --sourcemap",bench:"bun test tests/spatial-index-bench.test.ts",format:"biome format --write .","format:check":"biome format .","vercel-build":"cosmos-export","run-sample":"bun scripts/run-sample.ts","repomix:lib":"repomix --ignore 'testing/**,**/TwoRouteHighDensitySolver/**,**/RouteStitchingSolver/**,solvers/CapacitySegmentPointOptimizer/CapacitySegmentPointOptimizer.ts' lib","bug-report":"bun run scripts/download-bug-report.ts","bug-report-with-test":"bun run scripts/create-bug-report-test.ts"},devDependencies:{"@biomejs/biome":"^1.9.4","@radix-ui/react-icons":"^1.3.2","@radix-ui/react-menubar":"^1.1.14","@react-hook/resize-observer":"^2.0.2","@resvg/resvg-js":"^2.6.2","@tsci/seveibar.dataset-srj13":"git+https://github.com/tscircuit/dataset-srj13.git#56db70039aeb28a76540fe951b5a96be60f9e949","@tsci/tscircuit.dataset-srj12-bus-routing":"git+https://github.com/tscircuit/dataset-srj12-bus-routing.git#ba82f86a7d1288566b7144eb8661ad2549c5f328","@tscircuit/autorouting-dataset-01":"^1.0.32","@tscircuit/checks":"^0.0.126","@tscircuit/circuit-json-util":"^0.0.94","@tscircuit/core":"^0.0.337","@tscircuit/curvy-trace-solver":"^0.0.10","@tscircuit/dataset-srj05":"git+https://github.com/tscircuit/dataset-srj05.git#9a49c126a89c083dc4d2b72cd17184735f637762","@tscircuit/fixed-via-hypergraph-solver":"https://codeload.github.com/tscircuit/fixed-via-hypergraph-solver/tar.gz/bed37a6201b5dd07c9cc68b828917ecc20d6d049","@tscircuit/hypergraph":"^0.0.71","@tscircuit/jumper-topology-generator":"^0.0.4","@tscircuit/krt-wasm":"^0.1.0","@tscircuit/math-utils":"^0.0.27","@tscircuit/rectdiff":"git+https://github.com/tscircuit/rectdiff.git#4af388d","@tscircuit/solver-utils":"^0.0.16","@types/bun":"^1.2.23","@types/fast-json-stable-stringify":"^2.1.2","@types/object-hash":"^3.0.6","@types/rbush":"^4.0.0","@types/react":"^19.0.8","@types/react-dom":"^19.0.3","@vercel/node":"^5.1.7","@vitejs/plugin-react":"^4.3.4","bun-match-svg":"^0.0.14","circuit-json-to-connectivity-map":"^0.0.19","circuit-json":"^0.0.419","circuit-to-svg":"^0.0.220",clsx:"^2.1.1","dataset-srj11-45-degree":"git+https://github.com/tscircuit/dataset-srj11-45-degree.git#0add61e6a0e6b59f6defc36f257052f773e2d685",flatbush:"^4.4.0","graphics-debug":"0.0.94","high-density-dataset-z04":"git+https://github.com/tscircuit/high-density-dataset-z04.git#b9128ed52f5a50102b6526319be1d4ec33dca2c2",kleur:"^4.1.5","looks-same":"9","pcb-poly-hyper-graph":"https://codeload.github.com/tscircuit/pcb-poly-hyper-graph/tar.gz/80db1463c4a47506eeda15b2c14d59679de900f8",rbush:"^4.0.1",react:"18","react-cosmos":"^6.2.3","react-cosmos-plugin-vite":"^6.2.0","react-dom":"18","react-konva":"18",recharts:"^2.15.1","tailwind-merge":"^3.2.0",terser:"^5.43.1","tiny-hypergraph":"git+https://github.com/tscircuit/tiny-hypergraph.git#78db8cb1dc78bfb3569ea6cb86bacc86d04c7338","tiny-hypergraph-poly":"git+https://github.com/tscircuit/tiny-hypergraph.git#7b93b4c",tsup:"^8.3.6",typescript:"^5.9.3","use-mouse-matrix-transform":"^1.3.0",vite:"^6.0.11","vite-tsconfig-paths":"^5.1.4","zdwiel-dataset":"git+https://github.com/dwiel/tscircuit-benchmark.git#be36518b5bf51755dae92c230061ab3cf4e3e063","high-density-repair01":"git+https://github.com/tscircuit/high-density-repair01.git#f4804e26d6da845cb985e4681ebd528b7c5f2ce8","high-density-repair02":"https://codeload.github.com/tscircuit/high-density-repair02/tar.gz/2afc0cbba3bf2f7eb6b9cd33615d21e9ad9352d4","high-density-repair03":"git+https://github.com/tscircuit/high-density-repair03.git#db73a5f"},dependencies:{"@tscircuit/high-density-a01":"^0.0.37","fast-json-stable-stringify":"^2.1.0","object-hash":"^3.0.0"}};init_dist();init_dist3();var import_react=__toESM(require_react(),1),import_react_reconciler=__toESM(require_react_reconciler(),1),import_constants=__toESM(require_constants(),1);init_zod();init_dist();init_dist();init_zod();init_dist();init_dist();init_dist();init_dist4();init_dist();var import_react2=__toESM(require_react(),1);init_dist4();init_zod();init_zod();init_dist();function createMap(){return new IndexedMap}var IndexedMap=class _IndexedMap{constructor(){__publicField(this,"index",{});__publicField(this,"array",[])}size(){return this.array.length}empty(){return this.array.length===0}itemAt(index){return this.array[index]}contains(key){return this.index[key.id()]!==void 0}find(key){let i3=this.index[key.id()];return i3===void 0?void 0:this.array[i3]}setDefault(key,factory){let i3=this.index[key.id()];if(i3===void 0){let pair=new Pair(key,factory());return this.index[key.id()]=this.array.length,this.array.push(pair),pair}else return this.array[i3]}insert(key,value){let pair=new Pair(key,value),i3=this.index[key.id()];return i3===void 0?(this.index[key.id()]=this.array.length,this.array.push(pair)):this.array[i3]=pair,pair}erase(key){let i3=this.index[key.id()];if(i3===void 0)return;this.index[key.id()]=void 0;let pair=this.array[i3],last=this.array.pop();return pair!==last&&(this.array[i3]=last,this.index[last.first.id()]=i3),pair}copy(){let copy=new _IndexedMap;for(let i3=0;i3<this.array.length;i3++){let pair=this.array[i3].copy();copy.array[i3]=pair,copy.index[pair.first.id()]=i3}return copy}},Pair=class _Pair{constructor(first,second){__publicField(this,"first");__publicField(this,"second");this.first=first,this.second=second}copy(){return new _Pair(this.first,this.second)}};var Variable=class{constructor(name=""){__publicField(this,"_name");__publicField(this,"_value",0);__publicField(this,"_context",null);__publicField(this,"_id",VarId++);this._name=name}id(){return this._id}name(){return this._name}setName(name){this._name=name}context(){return this._context}setContext(context){this._context=context}value(){return this._value}setValue(value){this._value=value}plus(value){return new Expression(this,value)}minus(value){return new Expression(this,typeof value=="number"?-value:[-1,value])}multiply(coefficient){return new Expression([coefficient,this])}divide(coefficient){return new Expression([1/coefficient,this])}toJSON(){return{name:this._name,value:this._value}}toString(){return this._context+"["+this._name+":"+this._value+"]"}},VarId=0;var Expression=class _Expression{constructor(){__publicField(this,"_terms");__publicField(this,"_constant");let parsed=parseArgs(arguments);this._terms=parsed.terms,this._constant=parsed.constant}terms(){return this._terms}constant(){return this._constant}value(){let result=this._constant;for(let i3=0,n4=this._terms.size();i3<n4;i3++){let pair=this._terms.itemAt(i3);result+=pair.first.value()*pair.second}return result}plus(value){return new _Expression(this,value)}minus(value){return new _Expression(this,typeof value=="number"?-value:[-1,value])}multiply(coefficient){return new _Expression([coefficient,this])}divide(coefficient){return new _Expression([1/coefficient,this])}isConstant(){return this._terms.size()==0}toString(){let result=this._terms.array.map(function(pair){return pair.second+"*"+pair.first.toString()}).join(" + ");return!this.isConstant()&&this._constant!==0&&(result+=" + "),result+=this._constant,result}};function parseArgs(args){let constant=0,factory=()=>0,terms=createMap();for(let i3=0,n4=args.length;i3<n4;++i3){let item=args[i3];if(typeof item=="number")constant+=item;else if(item instanceof Variable)terms.setDefault(item,factory).second+=1;else if(item instanceof Expression){constant+=item.constant();let terms2=item.terms();for(let j4=0,k4=terms2.size();j4<k4;j4++){let termPair=terms2.itemAt(j4);terms.setDefault(termPair.first,factory).second+=termPair.second}}else if(item instanceof Array){if(item.length!==2)throw new Error("array must have length 2");let value=item[0],value2=item[1];if(typeof value!="number")throw new Error("array item 0 must be a number");if(value2 instanceof Variable)terms.setDefault(value2,factory).second+=value;else if(value2 instanceof Expression){constant+=value2.constant()*value;let terms2=value2.terms();for(let j4=0,k4=terms2.size();j4<k4;j4++){let termPair=terms2.itemAt(j4);terms.setDefault(termPair.first,factory).second+=termPair.second*value}}else throw new Error("array item 1 must be a variable or expression")}else throw new Error("invalid Expression argument: "+item)}return{terms,constant}}var _Strength=class _Strength{static create(a3,b3,c4,w4=1){let result=0;return result+=Math.max(0,Math.min(1e3,a3*w4))*1e6,result+=Math.max(0,Math.min(1e3,b3*w4))*1e3,result+=Math.max(0,Math.min(1e3,c4*w4)),result}static clip(value){return Math.max(0,Math.min(_Strength.required,value))}};__publicField(_Strength,"required",_Strength.create(1e3,1e3,1e3)),__publicField(_Strength,"strong",_Strength.create(1,0,0)),__publicField(_Strength,"medium",_Strength.create(0,1,0)),__publicField(_Strength,"weak",_Strength.create(0,0,1));var Strength=_Strength;var Operator;(function(Operator2){Operator2[Operator2.Le=0]="Le",Operator2[Operator2.Ge=1]="Ge",Operator2[Operator2.Eq=2]="Eq"})(Operator||(Operator={}));var Constraint=class{constructor(expression,operator,rhs,strength=Strength.required){__publicField(this,"_expression");__publicField(this,"_operator");__publicField(this,"_strength");__publicField(this,"_id",CnId++);this._operator=operator,this._strength=Strength.clip(strength),rhs===void 0&&expression instanceof Expression?this._expression=expression:this._expression=expression.minus(rhs)}id(){return this._id}expression(){return this._expression}op(){return this._operator}strength(){return this._strength}toString(){return this._expression.toString()+" "+["<=",">=","="][this._operator]+" 0 ("+this._strength.toString()+")"}},CnId=0;var Solver=class{constructor(){__publicField(this,"maxIterations",1e3);__publicField(this,"_cnMap",createCnMap());__publicField(this,"_rowMap",createRowMap());__publicField(this,"_varMap",createVarMap());__publicField(this,"_editMap",createEditMap());__publicField(this,"_infeasibleRows",[]);__publicField(this,"_objective",new Row);__publicField(this,"_artificial",null);__publicField(this,"_idTick",0)}createConstraint(lhs,operator,rhs,strength=Strength.required){let cn3=new Constraint(lhs,operator,rhs,strength);return this.addConstraint(cn3),cn3}addConstraint(constraint){if(this._cnMap.find(constraint)!==void 0)throw new Error("duplicate constraint");let data=this._createRow(constraint),row=data.row,tag=data.tag,subject=this._chooseSubject(row,tag);if(subject.type()===SymbolType.Invalid&&row.allDummies())if(nearZero(row.constant()))subject=tag.marker;else throw new Error("unsatisfiable constraint");if(subject.type()===SymbolType.Invalid){if(!this._addWithArtificialVariable(row))throw new Error("unsatisfiable constraint")}else row.solveFor(subject),this._substitute(subject,row),this._rowMap.insert(subject,row);this._cnMap.insert(constraint,tag),this._optimize(this._objective)}removeConstraint(constraint){let cnPair=this._cnMap.erase(constraint);if(cnPair===void 0)throw new Error("unknown constraint");this._removeConstraintEffects(constraint,cnPair.second);let marker=cnPair.second.marker,rowPair=this._rowMap.erase(marker);if(rowPair===void 0){let leaving=this._getMarkerLeavingSymbol(marker);if(leaving.type()===SymbolType.Invalid)throw new Error("failed to find leaving row");rowPair=this._rowMap.erase(leaving),rowPair.second.solveForEx(leaving,marker),this._substitute(marker,rowPair.second)}this._optimize(this._objective)}hasConstraint(constraint){return this._cnMap.contains(constraint)}getConstraints(){return this._cnMap.array.map(({first})=>first)}addEditVariable(variable,strength){if(this._editMap.find(variable)!==void 0)throw new Error("duplicate edit variable");if(strength=Strength.clip(strength),strength===Strength.required)throw new Error("bad required strength");let expr=new Expression(variable),cn3=new Constraint(expr,Operator.Eq,void 0,strength);this.addConstraint(cn3);let info={tag:this._cnMap.find(cn3).second,constraint:cn3,constant:0};this._editMap.insert(variable,info)}removeEditVariable(variable){let editPair=this._editMap.erase(variable);if(editPair===void 0)throw new Error("unknown edit variable");this.removeConstraint(editPair.second.constraint)}hasEditVariable(variable){return this._editMap.contains(variable)}suggestValue(variable,value){let editPair=this._editMap.find(variable);if(editPair===void 0)throw new Error("unknown edit variable");let rows=this._rowMap,info=editPair.second,delta=value-info.constant;info.constant=value;let marker=info.tag.marker,rowPair=rows.find(marker);if(rowPair!==void 0){rowPair.second.add(-delta)<0&&this._infeasibleRows.push(marker),this._dualOptimize();return}let other=info.tag.other;if(rowPair=rows.find(other),rowPair!==void 0){rowPair.second.add(delta)<0&&this._infeasibleRows.push(other),this._dualOptimize();return}for(let i3=0,n4=rows.size();i3<n4;++i3){let rowPair2=rows.itemAt(i3),row=rowPair2.second,coeff=row.coefficientFor(marker);coeff!==0&&row.add(delta*coeff)<0&&rowPair2.first.type()!==SymbolType.External&&this._infeasibleRows.push(rowPair2.first)}this._dualOptimize()}updateVariables(){let vars=this._varMap,rows=this._rowMap;for(let i3=0,n4=vars.size();i3<n4;++i3){let pair=vars.itemAt(i3),rowPair=rows.find(pair.second);rowPair!==void 0?pair.first.setValue(rowPair.second.constant()):pair.first.setValue(0)}}_getVarSymbol(variable){let factory=()=>this._makeSymbol(SymbolType.External);return this._varMap.setDefault(variable,factory).second}_createRow(constraint){let expr=constraint.expression(),row=new Row(expr.constant()),terms=expr.terms();for(let i3=0,n4=terms.size();i3<n4;++i3){let termPair=terms.itemAt(i3);if(!nearZero(termPair.second)){let symbol=this._getVarSymbol(termPair.first),basicPair=this._rowMap.find(symbol);basicPair!==void 0?row.insertRow(basicPair.second,termPair.second):row.insertSymbol(symbol,termPair.second)}}let objective=this._objective,strength=constraint.strength(),tag={marker:INVALID_SYMBOL,other:INVALID_SYMBOL};switch(constraint.op()){case Operator.Le:case Operator.Ge:{let coeff=constraint.op()===Operator.Le?1:-1,slack=this._makeSymbol(SymbolType.Slack);if(tag.marker=slack,row.insertSymbol(slack,coeff),strength<Strength.required){let error2=this._makeSymbol(SymbolType.Error);tag.other=error2,row.insertSymbol(error2,-coeff),objective.insertSymbol(error2,strength)}break}case Operator.Eq:{if(strength<Strength.required){let errplus=this._makeSymbol(SymbolType.Error),errminus=this._makeSymbol(SymbolType.Error);tag.marker=errplus,tag.other=errminus,row.insertSymbol(errplus,-1),row.insertSymbol(errminus,1),objective.insertSymbol(errplus,strength),objective.insertSymbol(errminus,strength)}else{let dummy=this._makeSymbol(SymbolType.Dummy);tag.marker=dummy,row.insertSymbol(dummy)}break}}return row.constant()<0&&row.reverseSign(),{row,tag}}_chooseSubject(row,tag){let cells=row.cells();for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3);if(pair.first.type()===SymbolType.External)return pair.first}let type=tag.marker.type();return(type===SymbolType.Slack||type===SymbolType.Error)&&row.coefficientFor(tag.marker)<0?tag.marker:(type=tag.other.type(),(type===SymbolType.Slack||type===SymbolType.Error)&&row.coefficientFor(tag.other)<0?tag.other:INVALID_SYMBOL)}_addWithArtificialVariable(row){let art=this._makeSymbol(SymbolType.Slack);this._rowMap.insert(art,row.copy()),this._artificial=row.copy(),this._optimize(this._artificial);let success=nearZero(this._artificial.constant());this._artificial=null;let pair=this._rowMap.erase(art);if(pair!==void 0){let basicRow=pair.second;if(basicRow.isConstant())return success;let entering=this._anyPivotableSymbol(basicRow);if(entering.type()===SymbolType.Invalid)return!1;basicRow.solveForEx(art,entering),this._substitute(entering,basicRow),this._rowMap.insert(entering,basicRow)}let rows=this._rowMap;for(let i3=0,n4=rows.size();i3<n4;++i3)rows.itemAt(i3).second.removeSymbol(art);return this._objective.removeSymbol(art),success}_substitute(symbol,row){let rows=this._rowMap;for(let i3=0,n4=rows.size();i3<n4;++i3){let pair=rows.itemAt(i3);pair.second.substitute(symbol,row),pair.second.constant()<0&&pair.first.type()!==SymbolType.External&&this._infeasibleRows.push(pair.first)}this._objective.substitute(symbol,row),this._artificial&&this._artificial.substitute(symbol,row)}_optimize(objective){let iterations=0;for(;iterations<this.maxIterations;){let entering=this._getEnteringSymbol(objective);if(entering.type()===SymbolType.Invalid)return;let leaving=this._getLeavingSymbol(entering);if(leaving.type()===SymbolType.Invalid)throw new Error("the objective is unbounded");let row=this._rowMap.erase(leaving).second;row.solveForEx(leaving,entering),this._substitute(entering,row),this._rowMap.insert(entering,row),iterations++}throw new Error("solver iterations exceeded")}_dualOptimize(){let rows=this._rowMap,infeasible=this._infeasibleRows;for(;infeasible.length!==0;){let leaving=infeasible.pop(),pair=rows.find(leaving);if(pair!==void 0&&pair.second.constant()<0){let entering=this._getDualEnteringSymbol(pair.second);if(entering.type()===SymbolType.Invalid)throw new Error("dual optimize failed");let row=pair.second;rows.erase(leaving),row.solveForEx(leaving,entering),this._substitute(entering,row),rows.insert(entering,row)}}}_getEnteringSymbol(objective){let cells=objective.cells();for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3),symbol=pair.first;if(pair.second<0&&symbol.type()!==SymbolType.Dummy)return symbol}return INVALID_SYMBOL}_getDualEnteringSymbol(row){let ratio=Number.MAX_VALUE,entering=INVALID_SYMBOL,cells=row.cells();for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3),symbol=pair.first,c4=pair.second;if(c4>0&&symbol.type()!==SymbolType.Dummy){let r5=this._objective.coefficientFor(symbol)/c4;r5<ratio&&(ratio=r5,entering=symbol)}}return entering}_getLeavingSymbol(entering){let ratio=Number.MAX_VALUE,found=INVALID_SYMBOL,rows=this._rowMap;for(let i3=0,n4=rows.size();i3<n4;++i3){let pair=rows.itemAt(i3),symbol=pair.first;if(symbol.type()!==SymbolType.External){let row=pair.second,temp=row.coefficientFor(entering);if(temp<0){let temp_ratio=-row.constant()/temp;temp_ratio<ratio&&(ratio=temp_ratio,found=symbol)}}}return found}_getMarkerLeavingSymbol(marker){let dmax=Number.MAX_VALUE,r12=dmax,r22=dmax,invalid=INVALID_SYMBOL,first=invalid,second=invalid,third=invalid,rows=this._rowMap;for(let i3=0,n4=rows.size();i3<n4;++i3){let pair=rows.itemAt(i3),row=pair.second,c4=row.coefficientFor(marker);if(c4===0)continue;let symbol=pair.first;if(symbol.type()===SymbolType.External)third=symbol;else if(c4<0){let r5=-row.constant()/c4;r5<r12&&(r12=r5,first=symbol)}else{let r5=row.constant()/c4;r5<r22&&(r22=r5,second=symbol)}}return first!==invalid?first:second!==invalid?second:third}_removeConstraintEffects(cn3,tag){tag.marker.type()===SymbolType.Error&&this._removeMarkerEffects(tag.marker,cn3.strength()),tag.other.type()===SymbolType.Error&&this._removeMarkerEffects(tag.other,cn3.strength())}_removeMarkerEffects(marker,strength){let pair=this._rowMap.find(marker);pair!==void 0?this._objective.insertRow(pair.second,-strength):this._objective.insertSymbol(marker,-strength)}_anyPivotableSymbol(row){let cells=row.cells();for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3),type=pair.first.type();if(type===SymbolType.Slack||type===SymbolType.Error)return pair.first}return INVALID_SYMBOL}_makeSymbol(type){return new Symbol2(type,this._idTick++)}};function nearZero(value){let eps=1e-8;return value<0?-value<eps:value<eps}function createCnMap(){return createMap()}function createRowMap(){return createMap()}function createVarMap(){return createMap()}function createEditMap(){return createMap()}var SymbolType;(function(SymbolType2){SymbolType2[SymbolType2.Invalid=0]="Invalid",SymbolType2[SymbolType2.External=1]="External",SymbolType2[SymbolType2.Slack=2]="Slack",SymbolType2[SymbolType2.Error=3]="Error",SymbolType2[SymbolType2.Dummy=4]="Dummy"})(SymbolType||(SymbolType={}));var Symbol2=class{constructor(type,id2){__publicField(this,"_id");__publicField(this,"_type");this._id=id2,this._type=type}id(){return this._id}type(){return this._type}},INVALID_SYMBOL=new Symbol2(SymbolType.Invalid,-1),Row=class _Row{constructor(constant=0){__publicField(this,"_cellMap",createMap());__publicField(this,"_constant");this._constant=constant}cells(){return this._cellMap}constant(){return this._constant}isConstant(){return this._cellMap.empty()}allDummies(){let cells=this._cellMap;for(let i3=0,n4=cells.size();i3<n4;++i3)if(cells.itemAt(i3).first.type()!==SymbolType.Dummy)return!1;return!0}copy(){let theCopy=new _Row(this._constant);return theCopy._cellMap=this._cellMap.copy(),theCopy}add(value){return this._constant+=value}insertSymbol(symbol,coefficient=1){let pair=this._cellMap.setDefault(symbol,()=>0);nearZero(pair.second+=coefficient)&&this._cellMap.erase(symbol)}insertRow(other,coefficient=1){this._constant+=other._constant*coefficient;let cells=other._cellMap;for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3);this.insertSymbol(pair.first,pair.second*coefficient)}}removeSymbol(symbol){this._cellMap.erase(symbol)}reverseSign(){this._constant=-this._constant;let cells=this._cellMap;for(let i3=0,n4=cells.size();i3<n4;++i3){let pair=cells.itemAt(i3);pair.second=-pair.second}}solveFor(symbol){let cells=this._cellMap,coeff=-1/cells.erase(symbol).second;this._constant*=coeff;for(let i3=0,n4=cells.size();i3<n4;++i3)cells.itemAt(i3).second*=coeff}solveForEx(lhs,rhs){this.insertSymbol(lhs,-1),this.solveFor(rhs)}coefficientFor(symbol){let pair=this._cellMap.find(symbol);return pair!==void 0?pair.second:0}substitute(symbol,row){let pair=this._cellMap.erase(symbol);pair!==void 0&&this.insertRow(row,pair.second)}};var import_debug9=__toESM(require_browser(),1);init_dist6();var import_react3=__toESM(require_react(),1);init_dist();var import_debug10=__toESM(require_browser(),1);init_dist6();init_dist();init_dist3();init_dist6();init_dist6();init_dist6();init_dist3();init_dist();init_dist6();init_dist6();init_src();init_dist6();init_dist3();init_dist6();init_dist3();init_dist6();init_dist3();init_dist6();init_dist6();init_dist3();init_dist6();init_dist6();init_dist3();init_dist6();init_dist6();init_dist3();init_dist6();init_dist3();init_dist6();init_dist6();init_dist6();init_dist6();init_dist6();function distance5(x12,y12,x22,y22){return Math.sqrt((x22-x12)**2+(y22-y12)**2)}var addStartAndEndPortIdsIfMissing=soup=>{let pcbPorts=soup.filter(item=>item.type==="pcb_port"),pcbSmtPads=soup.filter(item=>item.type==="pcb_smtpad"),pcbTraces=soup.filter(item=>item.type==="pcb_trace");function findPortIdOverlappingPoint(point7,options={}){let traceWidth=options.traceWidth||0,directPort=pcbPorts.find(port=>distance5(port.x,port.y,point7.x,point7.y)<.01);if(directPort)return directPort.pcb_port_id;if(options.isFirstOrLastPoint){let smtPad=pcbSmtPads.find(pad2=>{if(pad2.shape==="rect")return Math.abs(point7.x-pad2.x)<pad2.width/2+traceWidth/2&&Math.abs(point7.y-pad2.y)<pad2.height/2+traceWidth/2;if(pad2.shape==="circle")return distance5(point7.x,point7.y,pad2.x,pad2.y)<pad2.radius});if(smtPad)return smtPad.pcb_port_id??null}return null}for(let trace of pcbTraces)for(let index=0;index<trace.route.length;index++){let segment2=trace.route[index],isFirstOrLastPoint=index===0||index===trace.route.length-1;if(segment2.route_type==="wire"){if(!segment2.start_pcb_port_id&&index===0){let startPortId=findPortIdOverlappingPoint(segment2,{isFirstOrLastPoint,traceWidth:segment2.width});startPortId&&(segment2.start_pcb_port_id=startPortId)}if(!segment2.end_pcb_port_id&&index===trace.route.length-1){let endPortId=findPortIdOverlappingPoint(segment2,{isFirstOrLastPoint,traceWidth:segment2.width});endPortId&&(segment2.end_pcb_port_id=endPortId)}}}},CIRCUIT_JSON_ID_PATTERN=/\b(?:pcb|source|schematic|subcircuit)_[a-z0-9_]+\b/i,sanitizeReadableName=(candidate,id2,fallbackLabel)=>!candidate||candidate===id2||CIRCUIT_JSON_ID_PATTERN.test(candidate)?fallbackLabel:candidate,firstReadableName=(candidates,id2)=>{for(let candidate of candidates){let readableName=sanitizeReadableName(candidate,id2,"");if(readableName)return readableName}return""},getReadableNameForComponent=(circuitJson,pcbComponentId)=>sanitizeReadableName(getReadableNameForElement(circuitJson,pcbComponentId),pcbComponentId,"component"),getReadableNameForPort=(circuitJson,pcbPortId)=>{let pcbPort=circuitJson.find(element=>element.type==="pcb_port"&&element.pcb_port_id===pcbPortId);if(pcbPort?.type==="pcb_port"){let sourcePort=circuitJson.find(element=>element.type==="source_port"&&element.source_port_id===pcbPort.source_port_id),sourceComponent=sourcePort?.type==="source_port"?circuitJson.find(element=>element.type==="source_component"&&element.source_component_id===sourcePort.source_component_id):null,readableSourceComponentName=firstReadableName([sourceComponent?.type==="source_component"?sourceComponent.name:null],sourceComponent?.type==="source_component"?sourceComponent.source_component_id:""),readableSourcePortName=firstReadableName([sourcePort?.type==="source_port"?sourcePort.name:null,sourcePort?.type==="source_port"?sourcePort.pin_number?.toString():null,sourcePort?.type==="source_port"?sourcePort.port_hints?.[0]:null],sourcePort?.type==="source_port"?sourcePort.source_port_id:"");if(readableSourceComponentName&&readableSourcePortName)return`${readableSourceComponentName}.${readableSourcePortName}`;if(readableSourcePortName)return readableSourcePortName}return sanitizeReadableName(getReadableNameForPcbPort(circuitJson,pcbPortId)??getReadableNameForElement(circuitJson,pcbPortId),pcbPortId,"port")};var getReadableNameForElementId=(circuitJson,elementId)=>sanitizeReadableName(getReadableNameForElement(circuitJson,elementId),elementId,"element"),containsCircuitJsonId=message=>CIRCUIT_JSON_ID_PATTERN.test(message);function checkEachPcbPortConnectedToPcbTraces(circuitJson){addStartAndEndPortIdsIfMissing(circuitJson);let sourceTraces=circuitJson.filter(item=>item.type==="source_trace"),pcbPorts=circuitJson.filter(item=>item.type==="pcb_port"),errors=[],connectivityMap=getFullConnectivityMapFromCircuitJson(circuitJson),sourcePortToPcbPort=new Map;for(let pcbPort of pcbPorts)sourcePortToPcbPort.set(pcbPort.source_port_id,pcbPort);for(let sourceTrace of sourceTraces){let connectedSourcePortIds=sourceTrace.connected_source_port_ids;if(connectedSourcePortIds.length<2)continue;let pcbPortsInTrace=[],missingPcbPorts=[];for(let sourcePortId of connectedSourcePortIds){let pcbPort=sourcePortToPcbPort.get(sourcePortId);pcbPort?pcbPortsInTrace.push(pcbPort):missingPcbPorts.push(sourcePortId)}if(pcbPortsInTrace.length<2)continue;let firstPcbPort=pcbPortsInTrace[0],referenceNetId=connectivityMap.getNetConnectedToId(firstPcbPort.pcb_port_id);connectivityMap.getIdsConnectedToNet(referenceNetId).filter(id2=>circuitJson.some(element=>element.type==="pcb_trace"&&("pcb_trace_id"in element&&element.pcb_trace_id===id2||"route_id"in element&&element.route_id===id2))).length===0&&new Set(pcbPortsInTrace.map(p4=>p4.pcb_component_id)).size>1&&errors.push({type:"pcb_port_not_connected_error",message:`Ports [${pcbPortsInTrace.map(p4=>getReadableNameForPort(circuitJson,p4.pcb_port_id)).join(", ")}] are not connected together through the same net.`,error_type:"pcb_port_not_connected_error",pcb_port_ids:pcbPortsInTrace.map(p4=>p4.pcb_port_id),pcb_component_ids:pcbPortsInTrace.map(p4=>p4.pcb_component_id).filter(id2=>id2!==void 0),pcb_port_not_connected_error_id:`pcb_port_not_connected_error_trace_${sourceTrace.source_trace_id}`})}return errors}var SpatialObjectIndex=class{constructor({objects,getBounds:getBounds3,getId,CELL_SIZE}){__publicField(this,"buckets");__publicField(this,"objectsById");__publicField(this,"getBounds");__publicField(this,"getId");__publicField(this,"CELL_SIZE",.4);__publicField(this,"_idCounter",0);this.buckets=new Map,this.objectsById=new Map,this.getBounds=getBounds3,this.getId=getId??(()=>this._getNextId()),this.CELL_SIZE=CELL_SIZE??this.CELL_SIZE;for(let obj of objects)this.addObject(obj)}_getNextId(){return`${this._idCounter++}`}addObject(obj){let bounds=this.getBounds(obj),spatialIndexId=this.getId(obj),objWithId={...obj,spatialIndexId};this.objectsById.set(spatialIndexId,objWithId);let minBucketX=Math.floor(bounds.minX/this.CELL_SIZE),minBucketY=Math.floor(bounds.minY/this.CELL_SIZE),maxBucketX=Math.floor(bounds.maxX/this.CELL_SIZE),maxBucketY=Math.floor(bounds.maxY/this.CELL_SIZE);for(let bx3=minBucketX;bx3<=maxBucketX;bx3++)for(let by3=minBucketY;by3<=maxBucketY;by3++){let bucketKey=`${bx3}x${by3}`,bucket=this.buckets.get(bucketKey);bucket?bucket.push(objWithId):this.buckets.set(bucketKey,[objWithId])}}removeObject(id2){let obj=this.objectsById.get(id2);if(!obj)return!1;this.objectsById.delete(id2);let bounds=this.getBounds(obj),minBucketX=Math.floor(bounds.minX/this.CELL_SIZE),minBucketY=Math.floor(bounds.minY/this.CELL_SIZE),maxBucketX=Math.floor(bounds.maxX/this.CELL_SIZE),maxBucketY=Math.floor(bounds.maxY/this.CELL_SIZE);for(let bx3=minBucketX;bx3<=maxBucketX;bx3++)for(let by3=minBucketY;by3<=maxBucketY;by3++){let bucketKey=`${bx3}x${by3}`,bucket=this.buckets.get(bucketKey);if(bucket){let index=bucket.findIndex(item=>item.spatialIndexId===id2);index!==-1&&(bucket.splice(index,1),bucket.length===0&&this.buckets.delete(bucketKey))}}return!0}getBucketKey(x4,y4){return`${Math.floor(x4/this.CELL_SIZE)}x${Math.floor(y4/this.CELL_SIZE)}`}getObjectsInBounds(bounds,margin=0){let objects=[],addedIds=new Set,minBucketX=Math.floor((bounds.minX-margin)/this.CELL_SIZE),minBucketY=Math.floor((bounds.minY-margin)/this.CELL_SIZE),maxBucketX=Math.floor((bounds.maxX+margin)/this.CELL_SIZE),maxBucketY=Math.floor((bounds.maxY+margin)/this.CELL_SIZE);for(let bx3=minBucketX;bx3<=maxBucketX;bx3++)for(let by3=minBucketY;by3<=maxBucketY;by3++){let bucketKey=`${bx3}x${by3}`,bucket=this.buckets.get(bucketKey)||[];for(let obj of bucket){let id2=obj.spatialIndexId;addedIds.has(id2)||(addedIds.add(id2),objects.push(obj))}}return objects}},jlcMinTolerances={min_trace_width:.1,min_via_hole_edge_to_via_hole_edge_clearance:.1,min_plated_hole_drill_edge_to_drill_edge_clearance:.15,min_trace_to_pad_edge_clearance:.1,min_pad_edge_to_pad_edge_clearance:.1,min_board_edge_clearance:.2,min_via_hole_diameter:.2,min_via_pad_diameter:.3},DEFAULT_TRACE_MARGIN=.1,DEFAULT_TRACE_THICKNESS=jlcMinTolerances.min_trace_width,DEFAULT_VIA_DIAMETER=jlcMinTolerances.min_via_pad_diameter,DEFAULT_VIA_BOARD_MARGIN=jlcMinTolerances.min_board_edge_clearance,DEFAULT_SAME_NET_VIA_MARGIN=jlcMinTolerances.min_via_hole_edge_to_via_hole_edge_clearance,DEFAULT_DIFFERENT_NET_VIA_MARGIN=jlcMinTolerances.min_via_hole_edge_to_via_hole_edge_clearance,DEFAULT_PAD_PAD_CLEARANCE=jlcMinTolerances.min_pad_edge_to_pad_edge_clearance,DEFAULT_PAD_TRACE_CLEARANCE=jlcMinTolerances.min_trace_to_pad_edge_clearance,EPSILON2=.005,getPcbBoard=circuitJson=>circuitJson.find(el3=>el3.type==="pcb_board"),getBoardDrcValue=(board,key)=>board?.[key];function getLayersOfPcbElement(obj){return obj.type==="pcb_trace_segment"?[obj.layer]:obj.type==="pcb_smtpad"?[obj.layer]:obj.type==="pcb_plated_hole"?Array.isArray(obj.layers)?obj.layers:[...all_layers]:obj.type==="pcb_hole"?[...all_layers]:obj.type==="pcb_via"?Array.isArray(obj.layers)?obj.layers:[...all_layers]:obj.type==="pcb_keepout"?Array.isArray(obj.layers)?obj.layers:[]:[]}var getClosestPointBetweenSegmentAndBounds=(segment2,bounds)=>{let p12={x:segment2.x1,y:segment2.y1},p22={x:segment2.x2,y:segment2.y2},minX=bounds.minX,minY=bounds.minY,maxX=bounds.maxX,maxY=bounds.maxY;if(p12.x===p22.x&&p12.y===p22.y){let closestX=Math.max(minX,Math.min(maxX,p12.x)),closestY=Math.max(minY,Math.min(maxY,p12.y));return closestX===p12.x&&closestY===p12.y?{x:p12.x,y:p12.y}:{x:closestX,y:closestY}}let dx3=p22.x-p12.x,dy3=p22.y-p12.y,tMinX=dx3!==0?(minX-p12.x)/dx3:Number.NEGATIVE_INFINITY,tMaxX=dx3!==0?(maxX-p12.x)/dx3:Number.POSITIVE_INFINITY,tMinY=dy3!==0?(minY-p12.y)/dy3:Number.NEGATIVE_INFINITY,tMaxY=dy3!==0?(maxY-p12.y)/dy3:Number.POSITIVE_INFINITY,tEnter=Math.max(Math.min(tMinX,tMaxX),Math.min(tMinY,tMaxY)),tExit=Math.min(Math.max(tMinX,tMaxX),Math.max(tMinY,tMaxY));if(tEnter<=tExit&&tExit>=0&&tEnter<=1){let t52=Math.max(0,Math.min(1,tEnter));return{x:p12.x+t52*dx3,y:p12.y+t52*dy3}}let closestToP1={x:Math.max(minX,Math.min(maxX,p12.x)),y:Math.max(minY,Math.min(maxY,p12.y))},closestToP2={x:Math.max(minX,Math.min(maxX,p22.x)),y:Math.max(minY,Math.min(maxY,p22.y))},distToP1Squared=(closestToP1.x-p12.x)**2+(closestToP1.y-p12.y)**2,distToP2Squared=(closestToP2.x-p22.x)**2+(closestToP2.y-p22.y)**2,edges=[{start:{x:minX,y:minY},end:{x:maxX,y:minY}},{start:{x:maxX,y:minY},end:{x:maxX,y:maxY}},{start:{x:maxX,y:maxY},end:{x:minX,y:maxY}},{start:{x:minX,y:maxY},end:{x:minX,y:minY}}],minDistance=Math.min(distToP1Squared,distToP2Squared),closestPoint=distToP1Squared<=distToP2Squared?closestToP1:closestToP2,clamp22=(value,min,max)=>Math.max(min,Math.min(max,value));for(let edge of edges){let va3={x:p22.x-p12.x,y:p22.y-p12.y},vb3={x:edge.end.x-edge.start.x,y:edge.end.y-edge.start.y},w4={x:p12.x-edge.start.x,y:p12.y-edge.start.y},dotAA=va3.x*va3.x+va3.y*va3.y,dotAB=va3.x*vb3.x+va3.y*vb3.y,dotAW=va3.x*w4.x+va3.y*w4.y,dotBB=vb3.x*vb3.x+vb3.y*vb3.y,dotBW=vb3.x*w4.x+vb3.y*w4.y,denominator=dotAA*dotBB-dotAB*dotAB;if(Math.abs(denominator)<1e-10)continue;let tA2=(dotAB*dotBW-dotBB*dotAW)/denominator,tB=(dotAA*dotBW-dotAB*dotAW)/denominator;tA2=clamp22(tA2,0,1),tB=clamp22(tB,0,1);let closestOnSegment={x:p12.x+tA2*va3.x,y:p12.y+tA2*va3.y},closestOnEdge={x:edge.start.x+tB*vb3.x,y:edge.start.y+tB*vb3.y},dx22=closestOnSegment.x-closestOnEdge.x,dy22=closestOnSegment.y-closestOnEdge.y,distSquared=dx22*dx22+dy22*dy22;distSquared<minDistance&&(minDistance=distSquared,closestPoint={x:(closestOnSegment.x+closestOnEdge.x)/2,y:(closestOnSegment.y+closestOnEdge.y)/2})}return closestPoint},getClosestPointBetweenSegments=(segmentA,segmentB)=>{let a12={x:segmentA.x1,y:segmentA.y1},a22={x:segmentA.x2,y:segmentA.y2},b12={x:segmentB.x1,y:segmentB.y1},b22={x:segmentB.x2,y:segmentB.y2},va3={x:a22.x-a12.x,y:a22.y-a12.y},vb3={x:b22.x-b12.x,y:b22.y-b12.y},lenSqrA=va3.x*va3.x+va3.y*va3.y,lenSqrB=vb3.x*vb3.x+vb3.y*vb3.y;if(lenSqrA===0||lenSqrB===0){if(lenSqrA===0&&lenSqrB===0)return{x:(a12.x+b12.x)/2,y:(a12.y+b12.y)/2};if(lenSqrA===0){let t210=clamp4(((a12.x-b12.x)*vb3.x+(a12.y-b12.y)*vb3.y)/lenSqrB,0,1),closestOnB2={x:b12.x+t210*vb3.x,y:b12.y+t210*vb3.y};return{x:(a12.x+closestOnB2.x)/2,y:(a12.y+closestOnB2.y)/2}}let t52=clamp4(((b12.x-a12.x)*va3.x+(b12.y-a12.y)*va3.y)/lenSqrA,0,1),closestOnA2={x:a12.x+t52*va3.x,y:a12.y+t52*va3.y};return{x:(closestOnA2.x+b12.x)/2,y:(closestOnA2.y+b12.y)/2}}let w4={x:a12.x-b12.x,y:a12.y-b12.y},dotAA=va3.x*va3.x+va3.y*va3.y,dotAB=va3.x*vb3.x+va3.y*vb3.y,dotAW=va3.x*w4.x+va3.y*w4.y,dotBB=vb3.x*vb3.x+vb3.y*vb3.y,dotBW=vb3.x*w4.x+vb3.y*w4.y,denominator=dotAA*dotBB-dotAB*dotAB;if(denominator<1e-10)return closestPointsParallelSegments(a12,a22,b12,b22,va3,vb3,lenSqrA,lenSqrB);let tA2=(dotAB*dotBW-dotBB*dotAW)/denominator,tB=(dotAA*dotBW-dotAB*dotAW)/denominator;tA2=clamp4(tA2,0,1),tB=clamp4(tB,0,1),tB=(tA2*dotAB+dotBW)/dotBB,tB=clamp4(tB,0,1),tA2=(tB*dotAB-dotAW)/dotAA,tA2=clamp4(tA2,0,1);let closestOnA={x:a12.x+tA2*va3.x,y:a12.y+tA2*va3.y},closestOnB={x:b12.x+tB*vb3.x,y:b12.y+tB*vb3.y},dx3=closestOnA.x-closestOnB.x,dy3=closestOnA.y-closestOnB.y,distance42=Math.sqrt(dx3*dx3+dy3*dy3);return{x:(closestOnA.x+closestOnB.x)/2,y:(closestOnA.y+closestOnB.y)/2}},closestPointsParallelSegments=(a12,a22,b12,b22,va3,vb3,lenSqrA,lenSqrB)=>{let tA2=((b12.x-a12.x)*va3.x+(b12.y-a12.y)*va3.y)/lenSqrA;tA2=clamp4(tA2,0,1);let pointOnA1={x:a12.x+tA2*va3.x,y:a12.y+tA2*va3.y},tA22=((b22.x-a12.x)*va3.x+(b22.y-a12.y)*va3.y)/lenSqrA;tA22=clamp4(tA22,0,1);let pointOnA2={x:a12.x+tA22*va3.x,y:a12.y+tA22*va3.y},tB=((a12.x-b12.x)*vb3.x+(a12.y-b12.y)*vb3.y)/lenSqrB;tB=clamp4(tB,0,1);let pointOnB1={x:b12.x+tB*vb3.x,y:b12.y+tB*vb3.y},tB2=((a22.x-b12.x)*vb3.x+(a22.y-b12.y)*vb3.y)/lenSqrB;tB2=clamp4(tB2,0,1);let pointOnB2={x:b12.x+tB2*vb3.x,y:b12.y+tB2*vb3.y},closestPair=[{pointA:pointOnA1,pointB:b12,distance:Math.sqrt((pointOnA1.x-b12.x)**2+(pointOnA1.y-b12.y)**2)},{pointA:pointOnA2,pointB:b22,distance:Math.sqrt((pointOnA2.x-b22.x)**2+(pointOnA2.y-b22.y)**2)},{pointA:a12,pointB:pointOnB1,distance:Math.sqrt((a12.x-pointOnB1.x)**2+(a12.y-pointOnB1.y)**2)},{pointA:a22,pointB:pointOnB2,distance:Math.sqrt((a22.x-pointOnB2.x)**2+(a22.y-pointOnB2.y)**2)}].reduce((closest,current3)=>current3.distance<closest.distance?current3:closest);return{x:(closestPair.pointA.x+closestPair.pointB.x)/2,y:(closestPair.pointA.y+closestPair.pointB.y)/2}},clamp4=(value,min,max)=>Math.max(min,Math.min(max,value)),rotatePoint=(point7,angleDegrees)=>{let angle=angleDegrees*Math.PI/180;return{x:point7.x*Math.cos(angle)-point7.y*Math.sin(angle),y:point7.x*Math.sin(angle)+point7.y*Math.cos(angle)}},getRotatedRectPoints=({x:x4,y:y4,width,height,ccwRotation})=>{let halfWidth=width/2,halfHeight=height/2;return[{x:-halfWidth,y:-halfHeight},{x:halfWidth,y:-halfHeight},{x:halfWidth,y:halfHeight},{x:-halfWidth,y:halfHeight}].map(point7=>{let rotated=rotatePoint(point7,ccwRotation);return{x:x4+rotated.x,y:y4+rotated.y}})},getPolygonPointsForPad=pad2=>{if(pad2.type==="pcb_smtpad"){if(pad2.shape==="polygon")return pad2.points;if(pad2.shape==="rotated_rect")return getRotatedRectPoints({x:pad2.x,y:pad2.y,width:pad2.width,height:pad2.height,ccwRotation:pad2.ccw_rotation})}if(pad2.type==="pcb_plated_hole"&&"rect_pad_width"in pad2&&"rect_pad_height"in pad2)return getRotatedRectPoints({x:pad2.x,y:pad2.y,width:pad2.rect_pad_width,height:pad2.rect_pad_height,ccwRotation:"rect_ccw_rotation"in pad2&&typeof pad2.rect_ccw_rotation=="number"?pad2.rect_ccw_rotation:0});throw new Error(`Expected polygonal pad geometry, got ${pad2.type} with shape "${pad2.shape}"`)},getPolygonEdges3=points=>points.map((point7,index)=>[point7,points[(index+1)%points.length]]),getClosestPointsBetweenSegments=(a12,a22,b12,b22)=>{let intersection=getSegmentIntersection(a12,a22,b12,b22);if(intersection)return{distance:0,pointOnA:intersection,pointOnB:intersection,center:intersection};let candidates=[{pointOnA:a12,pointOnB:pointToSegmentClosestPoint(a12,b12,b22)},{pointOnA:a22,pointOnB:pointToSegmentClosestPoint(a22,b12,b22)},{pointOnA:pointToSegmentClosestPoint(b12,a12,a22),pointOnB:b12},{pointOnA:pointToSegmentClosestPoint(b22,a12,a22),pointOnB:b22}],best=candidates[0],bestDistanceSquared=distSq(best.pointOnA,best.pointOnB);for(let candidate of candidates.slice(1)){let candidateDistanceSquared=distSq(candidate.pointOnA,candidate.pointOnB);candidateDistanceSquared<bestDistanceSquared&&(best=candidate,bestDistanceSquared=candidateDistanceSquared)}return{distance:segmentToSegmentMinDistance(a12,a22,b12,b22),pointOnA:best.pointOnA,pointOnB:best.pointOnB,center:{x:(best.pointOnA.x+best.pointOnB.x)/2,y:(best.pointOnA.y+best.pointOnB.y)/2}}},getSegmentToPolygonClearance=(segment2,polygon2)=>{let start={x:segment2.x1,y:segment2.y1},end={x:segment2.x2,y:segment2.y2};if(polygon2.length<3)return{distance:Number.POSITIVE_INFINITY,center:start};let intersections=getPolygonEdges3(polygon2).map(([edgeStart,edgeEnd])=>getSegmentIntersection(start,end,edgeStart,edgeEnd)).filter(point7=>point7!==null);if(intersections.length>0){let dx3=end.x-start.x,dy3=end.y-start.y,lengthSquared=dx3*dx3+dy3*dy3;return intersections.sort((a3,b3)=>{let ta3=((a3.x-start.x)*dx3+(a3.y-start.y)*dy3)/lengthSquared,tb2=((b3.x-start.x)*dx3+(b3.y-start.y)*dy3)/lengthSquared;return ta3-tb2}),{distance:0,center:intersections[0]}}if(isPointInsidePolygon(start,polygon2)||isPointInsidePolygon(end,polygon2))return{distance:0,center:{x:(start.x+end.x)/2,y:(start.y+end.y)/2}};let best=getClosestPointsBetweenSegments(start,end,polygon2[0],polygon2[1]);for(let[edgeStart,edgeEnd]of getPolygonEdges3(polygon2).slice(1)){let candidate=getClosestPointsBetweenSegments(start,end,edgeStart,edgeEnd);candidate.distance<best.distance&&(best=candidate)}return{distance:best.distance,center:best.center}},getCollidableBounds=collidable=>{if(collidable.type==="pcb_trace_segment")return{minX:Math.min(collidable.x1,collidable.x2),minY:Math.min(collidable.y1,collidable.y2),maxX:Math.max(collidable.x1,collidable.x2),maxY:Math.max(collidable.y1,collidable.y2)};if((collidable.type==="pcb_smtpad"||collidable.type==="pcb_plated_hole")&&(collidable.type==="pcb_smtpad"&&(collidable.shape==="rotated_rect"||collidable.shape==="polygon")||collidable.type==="pcb_plated_hole"&&"rect_pad_width"in collidable&&"rect_pad_height"in collidable)){let polygonPoints=getPolygonPointsForPad(collidable);return{minX:Math.min(...polygonPoints.map(point7=>point7.x)),minY:Math.min(...polygonPoints.map(point7=>point7.y)),maxX:Math.max(...polygonPoints.map(point7=>point7.x)),maxY:Math.max(...polygonPoints.map(point7=>point7.y))}}return getBoundsOfPcbElements([collidable])};function getPcbPortIdsConnectedToTrace(trace){let connectedPcbPorts=new Set;for(let segment2 of trace.route)segment2.route_type==="wire"&&(segment2.start_pcb_port_id&&connectedPcbPorts.add(segment2.start_pcb_port_id),segment2.end_pcb_port_id&&connectedPcbPorts.add(segment2.end_pcb_port_id));return Array.from(connectedPcbPorts)}function getPcbPortIdsConnectedToTraces(traces){let connectedPorts=new Set;for(let trace of traces)for(let portId of getPcbPortIdsConnectedToTrace(trace))connectedPorts.add(portId);return Array.from(connectedPorts)}var getRadiusOfCircuitJsonElement=obj=>{if(obj.type==="pcb_via"||obj.type==="pcb_plated_hole"&&obj.shape==="circle")return obj.outer_diameter/2;if(obj.type==="pcb_hole"&&obj.hole_shape==="circle")return obj.hole_diameter/2;if(obj.type==="pcb_smtpad"&&obj.shape==="circle")return obj.radius;throw new Error(`Could not determine radius of element: ${JSON.stringify(obj)}`)};function checkEachPcbTraceNonOverlapping(circuitJson,{connMap,minClearance=DEFAULT_TRACE_MARGIN}={}){let errors=[];addStartAndEndPortIdsIfMissing(circuitJson),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let pcbTraceSegments=cju_default(circuitJson).pcb_trace.list().flatMap(pcbTrace=>{let segments=[];for(let i3=0;i3<pcbTrace.route.length-1;i3++){let p12=pcbTrace.route[i3],p22=pcbTrace.route[i3+1];p12.route_type==="wire"&&p22.route_type==="wire"&&p12.layer===p22.layer&&segments.push({type:"pcb_trace_segment",pcb_trace_id:pcbTrace.pcb_trace_id,_pcbTrace:pcbTrace,thickness:"width"in p12?p12.width:"width"in p22?p22.width:DEFAULT_TRACE_THICKNESS,layer:p12.layer,x1:p12.x,y1:p12.y,x2:p22.x,y2:p22.y})}return segments}),pcbSmtPads=cju_default(circuitJson).pcb_smtpad.list(),pcbPlatedHoles=cju_default(circuitJson).pcb_plated_hole.list(),pcbHoles=cju_default(circuitJson).pcb_hole.list(),pcbVias=cju_default(circuitJson).pcb_via.list(),pcbKeepouts=cju_default(circuitJson).pcb_keepout.list(),allObjects=[...pcbTraceSegments,...pcbSmtPads,...pcbPlatedHoles,...pcbHoles,...pcbVias,...pcbKeepouts],spatialIndex=new SpatialObjectIndex({objects:allObjects,getBounds:getCollidableBounds}),getReadableName=id2=>getReadableNameForElement(circuitJson,id2),constructErrorMessage=(traceName,otherName,gap)=>gap<0?`PCB trace ${traceName} overlaps with ${otherName} (accidental contact)`:`PCB trace ${traceName} is too close to ${otherName} (gap: ${gap.toFixed(3)}mm)`,errorIds=new Set;for(let segmentA of pcbTraceSegments){let requiredMargin=minClearance,bounds=getCollidableBounds(segmentA),nearbyObjects=spatialIndex.getObjectsInBounds(bounds,requiredMargin+segmentA.thickness/2);if(!(segmentA.x1===segmentA.x2&&segmentA.y1===segmentA.y2))for(let obj of nearbyObjects){if(!getLayersOfPcbElement(obj).includes(segmentA.layer))continue;if(obj.type==="pcb_trace_segment"){let segmentB=obj;if(segmentA.layer!==segmentB.layer||connMap.areIdsConnected(segmentA.pcb_trace_id,segmentB.pcb_trace_id))continue;let gap2=segmentToSegmentMinDistance({x:segmentA.x1,y:segmentA.y1},{x:segmentA.x2,y:segmentA.y2},{x:segmentB.x1,y:segmentB.y1},{x:segmentB.x2,y:segmentB.y2})-segmentA.thickness/2-segmentB.thickness/2;if(gap2>minClearance-EPSILON2)continue;let pcb_trace_error_id=`overlap_${segmentA.pcb_trace_id}_${segmentB.pcb_trace_id}`,pcb_trace_error_id_reverse=`overlap_${segmentB.pcb_trace_id}_${segmentA.pcb_trace_id}`;if(errorIds.has(pcb_trace_error_id)||errorIds.has(pcb_trace_error_id_reverse))continue;errorIds.add(pcb_trace_error_id),errors.push({type:"pcb_trace_error",error_type:"pcb_trace_error",message:constructErrorMessage(getReadableName(segmentA.pcb_trace_id),getReadableName(segmentB.pcb_trace_id),gap2),pcb_trace_id:segmentA.pcb_trace_id,source_trace_id:"",pcb_trace_error_id,pcb_component_ids:[],center:getClosestPointBetweenSegments(segmentA,segmentB),pcb_port_ids:getPcbPortIdsConnectedToTraces([segmentA._pcbTrace,segmentB._pcbTrace])});continue}let primaryObjId=getPrimaryId(obj);if(connMap.areIdsConnected(segmentA.pcb_trace_id,"pcb_trace_id"in obj?obj.pcb_trace_id:primaryObjId))continue;if(obj.type==="pcb_via"||obj.type==="pcb_plated_hole"&&obj.shape==="circle"||obj.type==="pcb_hole"||obj.type==="pcb_smtpad"&&obj.shape==="circle"){let radius=getRadiusOfCircuitJsonElement(obj),gap2=segmentToCircleMinDistance({x:segmentA.x1,y:segmentA.y1},{x:segmentA.x2,y:segmentA.y2},{x:obj.x,y:obj.y,radius})-segmentA.thickness/2;if(gap2>minClearance-EPSILON2)continue;let pcb_trace_error_id=`overlap_${segmentA.pcb_trace_id}_${primaryObjId}`;if(errorIds.has(pcb_trace_error_id))continue;errorIds.add(pcb_trace_error_id),errors.push({type:"pcb_trace_error",error_type:"pcb_trace_error",message:constructErrorMessage(getReadableName(segmentA.pcb_trace_id),`${obj.type} "${getReadableName(getPrimaryId(obj))}"`,gap2),pcb_trace_id:segmentA.pcb_trace_id,center:getClosestPointBetweenSegmentAndBounds(segmentA,getCollidableBounds(obj)),source_trace_id:"",pcb_trace_error_id,pcb_component_ids:["pcb_component_id"in obj?obj.pcb_component_id:void 0].filter(Boolean),pcb_port_ids:[...getPcbPortIdsConnectedToTraces([segmentA._pcbTrace]),"pcb_port_id"in obj?obj.pcb_port_id:void 0].filter(Boolean)})}if(obj.type==="pcb_smtpad"&&(obj.shape==="rotated_rect"||obj.shape==="polygon")||obj.type==="pcb_plated_hole"&&"rect_pad_width"in obj&&"rect_pad_height"in obj){let padOutline=getPolygonPointsForPad(obj),{distance:distance42,center:center2}=getSegmentToPolygonClearance(segmentA,padOutline),gap2=distance42-segmentA.thickness/2;if(gap2>minClearance-EPSILON2)continue;let pcb_trace_error_id=`overlap_${segmentA.pcb_trace_id}_${primaryObjId}`;if(errorIds.has(pcb_trace_error_id))continue;errorIds.add(pcb_trace_error_id),errors.push({type:"pcb_trace_error",error_type:"pcb_trace_error",message:constructErrorMessage(getReadableName(segmentA.pcb_trace_id),`${obj.type} "${getReadableName(getPrimaryId(obj))}"`,gap2),pcb_trace_id:segmentA.pcb_trace_id,center:center2,source_trace_id:"",pcb_trace_error_id,pcb_component_ids:["pcb_component_id"in obj?obj.pcb_component_id:void 0].filter(Boolean),pcb_port_ids:[...getPcbPortIdsConnectedToTraces([segmentA._pcbTrace]),"pcb_port_id"in obj?obj.pcb_port_id:void 0].filter(Boolean)});continue}let gap=segmentToBoundsMinDistance({x:segmentA.x1,y:segmentA.y1},{x:segmentA.x2,y:segmentA.y2},getCollidableBounds(obj))-segmentA.thickness/2;if(gap+EPSILON2<requiredMargin){let pcb_trace_error_id=`overlap_${segmentA.pcb_trace_id}_${primaryObjId}`;if(errorIds.has(pcb_trace_error_id))continue;errorIds.add(pcb_trace_error_id),errors.push({type:"pcb_trace_error",error_type:"pcb_trace_error",message:constructErrorMessage(getReadableName(segmentA.pcb_trace_id),`${obj.type} "${getReadableName(getPrimaryId(obj))}"`,gap),pcb_trace_id:segmentA.pcb_trace_id,source_trace_id:"",pcb_trace_error_id,pcb_component_ids:["pcb_component_id"in obj?obj.pcb_component_id:void 0].filter(Boolean),center:getClosestPointBetweenSegmentAndBounds(segmentA,getCollidableBounds(obj)),pcb_port_ids:[...getPcbPortIdsConnectedToTraces([segmentA._pcbTrace]),"pcb_port_id"in obj?obj.pcb_port_id:void 0].filter(Boolean)})}}}return errors}function checkViasOffBoard(circuitJson){let board=getPcbBoard(circuitJson);if(!board)return[];let vias=circuitJson.filter(el3=>el3.type==="pcb_via");if(vias.length===0)return[];if(board.width===void 0||board.height===void 0)return[];let boardEdgeClearance=getBoardDrcValue(board,"min_board_edge_clearance")??jlcMinTolerances.min_board_edge_clearance,boardMinX=board.center.x-board.width/2,boardMaxX=board.center.x+board.width/2,boardMinY=board.center.y-board.height/2,boardMaxY=board.center.y+board.height/2,errors=[];for(let via of vias){let viaRadius=via.outer_diameter/2,viaMinX=via.x-viaRadius,viaMaxX=via.x+viaRadius,viaMinY=via.y-viaRadius,viaMaxY=via.y+viaRadius;if(viaMinX<boardMinX+boardEdgeClearance||viaMaxX>boardMaxX-boardEdgeClearance||viaMinY<boardMinY+boardEdgeClearance||viaMaxY>boardMaxY-boardEdgeClearance){let viaName=getReadableNameForElement(circuitJson,via.pcb_via_id);errors.push({type:"pcb_placement_error",pcb_placement_error_id:`out_of_board_${via.pcb_via_id}`,message:`Via ${viaName} is outside or crossing the board boundary`,error_type:"pcb_placement_error"})}}return errors}function isPolygonCCW(poly){return poly.area()>=0}function rectanglePolygon({center:center2,size:size3,rotationDeg=0}){let cx3=center2.x,cy3=center2.y,hw3=size3.width/2,hh3=size3.height/2,corners=[new Point$3(cx3-hw3,cy3-hh3),new Point$3(cx3+hw3,cy3-hh3),new Point$3(cx3+hw3,cy3+hh3),new Point$3(cx3-hw3,cy3+hh3)],poly=new Polygon$1(corners);if(rotationDeg){let matrix2=rotateDEG(rotationDeg,cx3,cy3),rotatedCorners=corners.map(pt3=>{let p4=applyToPoint(matrix2,{x:pt3.x,y:pt3.y});return new Point$3(p4.x,p4.y)});poly=new Polygon$1(rotatedCorners)}return isPolygonCCW(poly)||poly.reverse(),poly}function boardToPolygon({board}){if(board.outline&&board.outline.length>0){let points=board.outline.map(p4=>new Point$3(p4.x,p4.y)),poly=new Polygon$1(points);return isPolygonCCW(poly)||poly.reverse(),poly}return board.center&&typeof board.width=="number"&&typeof board.height=="number"?rectanglePolygon({center:board.center,size:{width:board.width,height:board.height},rotationDeg:0}):null}function getComponentName({circuitJson,component}){if(component.source_component_id){let sourceComponent=circuitJson.find(el3=>el3.type==="source_component"&&el3.source_component_id===component.source_component_id);if(sourceComponent&&"name"in sourceComponent&&sourceComponent.name)return sourceComponent.name}return getReadableNameForComponent(circuitJson,component.pcb_component_id)}function computeOverlapDistance(compPoly,boardPoly,componentCenter,componentWidth,componentHeight,rotationDeg){let centerPoint=new Point$3(componentCenter.x,componentCenter.y);if(!boardPoly.contains(centerPoint)){let dist=boardPoly.distanceTo(centerPoint);return Array.isArray(dist)?dist[0]:Number(dist)||0}let hw3=componentWidth/2,hh3=componentHeight/2,corners=[{x:componentCenter.x-hw3,y:componentCenter.y-hh3},{x:componentCenter.x+hw3,y:componentCenter.y-hh3},{x:componentCenter.x+hw3,y:componentCenter.y+hh3},{x:componentCenter.x-hw3,y:componentCenter.y+hh3}],midpoints=[];for(let i3=0;i3<4;i3++){let next2=(i3+1)%4;midpoints.push({x:(corners[i3].x+corners[next2].x)/2,y:(corners[i3].y+corners[next2].y)/2})}let matrix2=rotateDEG(rotationDeg,componentCenter.x,componentCenter.y),rotatePoint22=pt3=>{let p4=applyToPoint(matrix2,pt3);return new Point$3(p4.x,p4.y)},rotatedPoints=corners.concat(midpoints).map(rotatePoint22),maxDistance=0;for(let pt3 of rotatedPoints)if(!boardPoly.contains(pt3)){let dist=boardPoly.distanceTo(pt3),d4=Array.isArray(dist)?dist[0]:Number(dist)||0;d4>maxDistance&&(maxDistance=d4)}if(maxDistance>0)return maxDistance;try{let intersection=BooleanOperations.intersect(compPoly,boardPoly),intersectionArea=0;intersection?Array.isArray(intersection)?intersectionArea=intersection.reduce((sum,p4)=>sum+(typeof p4.area=="function"?p4.area():0),0):typeof intersection.area=="function"?intersectionArea=intersection.area():intersectionArea=0:intersectionArea=0;let compArea=compPoly.area();if(intersectionArea>0&&intersectionArea<compArea){let overlapRatio=1-intersectionArea/compArea,compWidth=Math.abs(componentWidth),compHeight=Math.abs(componentHeight);return Math.min(compWidth,compHeight)*overlapRatio}else return .1}catch{return .1}}function getRepositionSuggestion({componentPoly,boardPoly}){let boardBox=boardPoly.box,componentBox=componentPoly.box,deltaX=0,deltaY=0;if(componentBox.xmin<boardBox.xmin?deltaX=boardBox.xmin-componentBox.xmin:componentBox.xmax>boardBox.xmax&&(deltaX=boardBox.xmax-componentBox.xmax),componentBox.ymin<boardBox.ymin?deltaY=boardBox.ymin-componentBox.ymin:componentBox.ymax>boardBox.ymax&&(deltaY=boardBox.ymax-componentBox.ymax),deltaX===0&&deltaY===0)return null;let xDir=deltaX>=0?"right":"left",yDir=deltaY>=0?"up":"down",absDx=Math.abs(Math.round(deltaX*100)/100),absDy=Math.abs(Math.round(deltaY*100)/100);return absDx>0&&absDy>0?`Try moving it ${absDx}mm ${xDir} and ${absDy}mm ${yDir} to fit within the board edge.`:absDx>0?`Try moving it ${absDx}mm ${xDir} to fit within the board edge.`:`Try moving it ${absDy}mm ${yDir} to fit within the board edge.`}function checkPcbComponentsOutOfBoard(circuitJson){let board=circuitJson.find(el3=>el3.type==="pcb_board");if(!board)return[];let boardPoly=boardToPolygon({board});if(!boardPoly)return[];let components=circuitJson.filter(el3=>el3.type==="pcb_component");if(components.length===0)return[];let errors=[];for(let c4 of components){if(c4.is_allowed_to_be_off_board||!c4.center||typeof c4.width!="number"||typeof c4.height!="number"||c4.width<=0||c4.height<=0)continue;let compPoly=rectanglePolygon({center:c4.center,size:{width:c4.width,height:c4.height},rotationDeg:0});if(compPoly.area()===0||boardPoly.contains(compPoly))continue;let overlapDistance=computeOverlapDistance(compPoly,boardPoly,c4.center,c4.width,c4.height,0),compName=getComponentName({circuitJson,component:c4}),overlapDistanceMm=Math.round(overlapDistance*100)/100,repositionSuggestion=getRepositionSuggestion({componentPoly:compPoly,boardPoly});errors.push({type:"pcb_component_outside_board_error",error_type:"pcb_component_outside_board_error",pcb_component_outside_board_error_id:`pcb_component_outside_board_${c4.pcb_component_id}`,message:`Component ${compName} extends outside board boundaries by ${overlapDistanceMm}mm.${repositionSuggestion?` ${repositionSuggestion}`:""}`,pcb_component_id:c4.pcb_component_id,pcb_board_id:board.pcb_board_id,component_center:c4.center,component_bounds:{min_x:compPoly.box.xmin,max_x:compPoly.box.xmax,min_y:compPoly.box.ymin,max_y:compPoly.box.ymax},subcircuit_id:c4.subcircuit_id,source_component_id:c4.source_component_id})}return errors}function distance22(a3,b3){return Math.hypot(a3.x-b3.x,a3.y-b3.y)}function viasAreAtSameLocation(a3,b3){return distance22(a3,b3)<=EPSILON2}function checkSameNetViaSpacing(circuitJson,{connMap,minClearance}={}){let vias=circuitJson.filter(el3=>el3.type==="pcb_via");if(vias.length<2)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_via_hole_edge_to_via_hole_edge_clearance")??jlcMinTolerances.min_via_hole_edge_to_via_hole_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let errors=[],reported=new Set;for(let i3=0;i3<vias.length;i3++)for(let j4=i3+1;j4<vias.length;j4++){let viaA=vias[i3],viaB=vias[j4];if(viasAreAtSameLocation(viaA,viaB)||!connMap.areIdsConnected(viaA.pcb_via_id,viaB.pcb_via_id))continue;let gap=distance22(viaA,viaB)-viaA.hole_diameter/2-viaB.hole_diameter/2;if(gap+EPSILON2>=minClearance)continue;let pairId=[viaA.pcb_via_id,viaB.pcb_via_id].sort().join("_");reported.has(pairId)||(reported.add(pairId),errors.push({type:"pcb_via_clearance_error",pcb_error_id:`same_net_vias_close_${pairId}`,message:`Vias ${getReadableNameForElement(circuitJson,viaA.pcb_via_id)} and ${getReadableNameForElement(circuitJson,viaB.pcb_via_id)} are too close together (gap: ${gap.toFixed(3)}mm)`,error_type:"pcb_via_clearance_error",pcb_via_ids:[viaA.pcb_via_id,viaB.pcb_via_id],minimum_clearance:minClearance,actual_clearance:gap,pcb_center:{x:(viaA.x+viaB.x)/2,y:(viaA.y+viaB.y)/2}}))}return errors}function checkDifferentNetViaSpacing(circuitJson,{connMap,minClearance}={}){let vias=circuitJson.filter(el3=>el3.type==="pcb_via");if(vias.length<2)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_via_hole_edge_to_via_hole_edge_clearance")??jlcMinTolerances.min_via_hole_edge_to_via_hole_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let errors=[],reported=new Set;for(let i3=0;i3<vias.length;i3++)for(let j4=i3+1;j4<vias.length;j4++){let viaA=vias[i3],viaB=vias[j4];if(viasAreAtSameLocation(viaA,viaB)||connMap.areIdsConnected(viaA.pcb_via_id,viaB.pcb_via_id))continue;let gap=distance22(viaA,viaB)-viaA.hole_diameter/2-viaB.hole_diameter/2;if(gap+EPSILON2>=minClearance)continue;let pairId=[viaA.pcb_via_id,viaB.pcb_via_id].sort().join("_");reported.has(pairId)||(reported.add(pairId),errors.push({type:"pcb_via_clearance_error",pcb_error_id:`different_net_vias_close_${pairId}`,message:`Vias ${getReadableNameForElement(circuitJson,viaA.pcb_via_id)} and ${getReadableNameForElement(circuitJson,viaB.pcb_via_id)} from different nets are too close together (gap: ${gap.toFixed(3)}mm)`,error_type:"pcb_via_clearance_error",pcb_via_ids:[viaA.pcb_via_id,viaB.pcb_via_id],minimum_clearance:minClearance,actual_clearance:gap,pcb_center:{x:(viaA.x+viaB.x)/2,y:(viaA.y+viaB.y)/2}}))}return errors}var getSourceTraceIdsFromPcbTrace=pcbTraceSourceTraceId=>pcbTraceSourceTraceId?pcbTraceSourceTraceId.includes("__")?pcbTraceSourceTraceId.split("__").filter(part=>part.startsWith("source_trace_")):[pcbTraceSourceTraceId]:[];function checkSourceTracesHavePcbTraces(circuitJson){let errors=[],sourceTraces=circuitJson.filter(el3=>el3.type==="source_trace"),pcbTraces=circuitJson.filter(el3=>el3.type==="pcb_trace");for(let sourceTrace of sourceTraces){if(!sourceTrace.connected_source_port_ids?.length||(sourceTrace.connected_source_net_ids?.length??0)>0||sourceTrace.connected_source_port_ids.length<2)continue;if(!pcbTraces.some(pcbTrace=>getSourceTraceIdsFromPcbTrace(pcbTrace.source_trace_id).includes(sourceTrace.source_trace_id))){let connectedPcbPorts=circuitJson.filter(el3=>el3.type==="pcb_port"&&sourceTrace.connected_source_port_ids.includes(el3.source_port_id)),connectedPcbComponentIds=Array.from(new Set(connectedPcbPorts.map(port=>port.pcb_component_id).filter(id2=>id2!==void 0)));errors.push({type:"pcb_trace_missing_error",pcb_trace_missing_error_id:`pcb_trace_missing_${sourceTrace.source_trace_id}`,error_type:"pcb_trace_missing_error",message:`Trace [${sourceTrace.display_name&&!containsCircuitJsonId(sourceTrace.display_name)?sourceTrace.display_name:"trace"}] is not connected (it has no PCB trace)`,source_trace_id:sourceTrace.source_trace_id,pcb_component_ids:connectedPcbComponentIds,pcb_port_ids:connectedPcbPorts.map(port=>port.pcb_port_id)})}}return errors}function getBoardPolygonPoints(board){if(board.outline&&board.outline.length>0)return board.outline.map(p4=>({x:p4.x,y:p4.y}));if(board.center&&typeof board.width=="number"&&typeof board.height=="number"){let cx3=board.center.x,cy3=board.center.y,hw3=board.width/2,hh3=board.height/2;return[{x:cx3-hw3,y:cy3-hh3},{x:cx3+hw3,y:cy3-hh3},{x:cx3+hw3,y:cy3+hh3},{x:cx3-hw3,y:cy3+hh3}]}return null}function checkPcbTracesOutOfBoard(circuitJson,config={}){let errors=[],board=getPcbBoard(circuitJson);if(!board)return errors;let margin=config.margin??getBoardDrcValue(board,"min_board_edge_clearance")??jlcMinTolerances.min_board_edge_clearance,boardPoints=getBoardPolygonPoints(board);if(!boardPoints)return errors;let pcbTraces=cju_default(circuitJson).pcb_trace.list();for(let trace of pcbTraces)if(!(trace.route.length<2))for(let i3=0;i3<trace.route.length-1;i3++){let p12=trace.route[i3],p22=trace.route[i3+1];if(p12.route_type!=="wire"||p22.route_type!=="wire")continue;let traceWidth="width"in p12?p12.width:"width"in p22?p22.width:.1,segmentStart={x:p12.x,y:p12.y},segmentEnd={x:p22.x,y:p22.y},minDistance=Number.POSITIVE_INFINITY;for(let j4=0;j4<boardPoints.length;j4++){let edgeStart=boardPoints[j4],edgeEnd=boardPoints[(j4+1)%boardPoints.length],distance42=segmentToSegmentMinDistance(segmentStart,segmentEnd,edgeStart,edgeEnd);distance42<minDistance&&(minDistance=distance42)}let minimumDistance=traceWidth/2+margin;if(minDistance<minimumDistance){let error2={type:"pcb_trace_error",error_type:"pcb_trace_error",pcb_trace_error_id:`trace_too_close_to_board_${trace.pcb_trace_id}_segment_${i3}`,message:`Trace too close to board edge (${minDistance.toFixed(3)}mm < ${minimumDistance.toFixed(3)}mm required, margin: ${margin}mm)`,pcb_trace_id:trace.pcb_trace_id,source_trace_id:trace.source_trace_id||"",center:{x:(segmentStart.x+segmentEnd.x)/2,y:(segmentStart.y+segmentEnd.y)/2},pcb_component_ids:[],pcb_port_ids:[]};errors.push(error2)}}return errors}function getElementLayers(elem){return getLayersOfPcbElement(elem)}function doLayersOverlap(layers1,layers2){return layers1.length===0||layers2.length===0?!0:layers1.some(l4=>layers2.includes(l4))}function doPcbElementsOverlap(elem1,elem2){let layers1=getElementLayers(elem1),layers2=getElementLayers(elem2);if(!doLayersOverlap(layers1,layers2))return!1;let bounds1=getBoundsOfPcbElements([elem1]),bounds2=getBoundsOfPcbElements([elem2]);return doBoundsOverlap(bounds1,bounds2)}var formatOverlapElementDescription=(circuitJson,element)=>{if("pcb_port_id"in element&&element.pcb_port_id)return getReadableNameForPort(circuitJson,element.pcb_port_id);let id2=getPrimaryId(element),readableName=getReadableNameForElementId(circuitJson,id2);return readableName==="element"?`[${id2}]`:readableName};function checkPcbComponentOverlap(circuitJson){let errors=[],connMap=getFullConnectivityMapFromCircuitJson(circuitJson),smtPads=cju_default(circuitJson).pcb_smtpad.list(),platedHoles=cju_default(circuitJson).pcb_plated_hole.list(),holes=cju_default(circuitJson).pcb_hole.list(),componentMap=new Map;for(let pad2 of smtPads){let componentId=pad2.pcb_component_id||`standalone_pad_${getPrimaryId(pad2)}`;componentMap.has(componentId)||componentMap.set(componentId,{component_id:componentId,elements:[],bounds:{minX:0,minY:0,maxX:0,maxY:0}}),componentMap.get(componentId).elements.push(pad2)}for(let hole of platedHoles){let componentId=hole.pcb_component_id||`standalone_plated_hole_${getPrimaryId(hole)}`;componentMap.has(componentId)||componentMap.set(componentId,{component_id:componentId,elements:[],bounds:{minX:0,minY:0,maxX:0,maxY:0}}),componentMap.get(componentId).elements.push(hole)}for(let hole of holes){let componentId=`standalone_hole_${getPrimaryId(hole)}`;componentMap.set(componentId,{component_id:componentId,elements:[hole],bounds:{minX:0,minY:0,maxX:0,maxY:0}})}for(let[componentId,componentData]of componentMap)componentData.elements.length>0&&(componentData.bounds=getBoundsOfPcbElements(componentData.elements));let componentsWithElements=Array.from(componentMap.values());for(let i3=0;i3<componentsWithElements.length;i3++)for(let j4=i3+1;j4<componentsWithElements.length;j4++){let comp1=componentsWithElements[i3],comp2=componentsWithElements[j4];if(doBoundsOverlap(comp1.bounds,comp2.bounds))for(let elem1 of comp1.elements)for(let elem2 of comp2.elements){let id1=getPrimaryId(elem1),id2=getPrimaryId(elem2);if(!(elem1.type==="pcb_smtpad"&&elem2.type==="pcb_smtpad"&&connMap.areIdsConnected(id1,id2))&&doPcbElementsOverlap(elem1,elem2)){let elem1Description=formatOverlapElementDescription(circuitJson,elem1),elem2Description=formatOverlapElementDescription(circuitJson,elem2),error2={type:"pcb_footprint_overlap_error",pcb_error_id:`pcb_footprint_overlap_${id1}_${id2}`,error_type:"pcb_footprint_overlap_error",message:`${elem1.type} ${elem1Description} overlaps with ${elem2.type} ${elem2Description}`};(elem1.type==="pcb_smtpad"||elem2.type==="pcb_smtpad")&&(error2.pcb_smtpad_ids=[],elem1.type==="pcb_smtpad"&&error2.pcb_smtpad_ids.push(id1),elem2.type==="pcb_smtpad"&&error2.pcb_smtpad_ids.push(id2)),(elem1.type==="pcb_plated_hole"||elem2.type==="pcb_plated_hole")&&(error2.pcb_plated_hole_ids=[],elem1.type==="pcb_plated_hole"&&error2.pcb_plated_hole_ids.push(id1),elem2.type==="pcb_plated_hole"&&error2.pcb_plated_hole_ids.push(id2)),(elem1.type==="pcb_hole"||elem2.type==="pcb_hole")&&(error2.pcb_hole_ids=[],elem1.type==="pcb_hole"&&error2.pcb_hole_ids.push(id1),elem2.type==="pcb_hole"&&error2.pcb_hole_ids.push(id2)),errors.push(error2)}}}return errors}var formatMm=value=>{let rounded=Math.round(value*1e3)/1e3;return`${Number(rounded.toFixed(3))}mm`},getPadBounds=pad2=>getBoundsOfPcbElements([pad2]),getPadCenter=pad2=>{let bounds=getPadBounds(pad2);return midpoint({x:bounds.minX,y:bounds.minY},{x:bounds.maxX,y:bounds.maxY})},getPadRadius=pad2=>{let bounds=getPadBounds(pad2);return Math.min(bounds.maxX-bounds.minX,bounds.maxY-bounds.minY)/2},isCircularPad=pad2=>pad2.shape==="circle",getCircleShape=pad2=>{let center2=getPadCenter(pad2);return{kind:"circle",x:center2.x,y:center2.y,radius:getPadRadius(pad2)}},getPolygonShape=pad2=>{let bounds=getPadBounds(pad2);return{kind:"polygon",points:[{x:bounds.minX,y:bounds.minY},{x:bounds.maxX,y:bounds.minY},{x:bounds.maxX,y:bounds.maxY},{x:bounds.minX,y:bounds.maxY}]}},getPadToPadGap=(padA,padB)=>isCircularPad(padA)&&isCircularPad(padB)?distanceBetweenCircleAndCircle(getCircleShape(padA),getCircleShape(padB)):isCircularPad(padA)?distanceBetweenCircleAndPolygon(getCircleShape(padA),getPolygonShape(padB)):isCircularPad(padB)?distanceBetweenCircleAndPolygon(getCircleShape(padB),getPolygonShape(padA)):distanceBetweenPolygonAndPolygon(getPolygonShape(padA),getPolygonShape(padB)),getPads=circuitJson=>[...cju_default(circuitJson).pcb_smtpad.list(),...cju_default(circuitJson).pcb_plated_hole.list()],getTraceSegments=circuitJson=>cju_default(circuitJson).pcb_trace.list().flatMap(pcbTrace=>{let segments=[];for(let i3=0;i3<pcbTrace.route.length-1;i3++){let p12=pcbTrace.route[i3],p22=pcbTrace.route[i3+1];p12.route_type==="wire"&&p22.route_type==="wire"&&p12.layer===p22.layer&&segments.push({type:"pcb_trace_segment",pcb_trace_id:pcbTrace.pcb_trace_id,_pcbTrace:pcbTrace,thickness:"width"in p12?p12.width:"width"in p22?p22.width:DEFAULT_TRACE_THICKNESS,layer:p12.layer,x1:p12.x,y1:p12.y,x2:p22.x,y2:p22.y})}return segments});function checkPadPadClearance(circuitJson,{connMap,minClearance}={}){let pads=getPads(circuitJson);if(pads.length<2)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_pad_edge_to_pad_edge_clearance")??jlcMinTolerances.min_pad_edge_to_pad_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let spatialIndex=new SpatialObjectIndex({objects:pads,getBounds:getPadBounds,getId:pad2=>getPrimaryId(pad2)}),errors=new Map;for(let padA of pads){let padAId=getPrimaryId(padA),nearbyPads=spatialIndex.getObjectsInBounds(getPadBounds(padA),minClearance);for(let padB of nearbyPads){let padBId=getPrimaryId(padB);if(padAId===padBId||!getLayersOfPcbElement(padA).some(layer=>getLayersOfPcbElement(padB).includes(layer))||connMap.areIdsConnected(padAId,padBId))continue;let pairId=[padAId,padBId].sort().join("_"),gap=getPadToPadGap(padA,padB);if(gap+EPSILON2>=minClearance)continue;let centerA=getPadCenter(padA),centerB=getPadCenter(padB),nextError={type:"pcb_pad_pad_clearance_error",pcb_pad_pad_clearance_error_id:`pad_pad_clearance_${pairId}`,error_type:"pcb_pad_pad_clearance_error",message:`Pads ${getReadableNameForElement(circuitJson,padAId)} and ${getReadableNameForElement(circuitJson,padBId)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(minClearance)})`,pcb_pad_ids:[padAId,padBId],minimum_clearance:minClearance,actual_clearance:gap,center:{x:(centerA.x+centerB.x)/2,y:(centerA.y+centerB.y)/2}};errors.has(pairId)||errors.set(pairId,nextError)}}return Array.from(errors.values())}function checkPadTraceClearance(circuitJson,{connMap,minClearance}={}){let pads=getPads(circuitJson),segments=getTraceSegments(circuitJson);if(pads.length===0||segments.length===0)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_trace_to_pad_edge_clearance")??jlcMinTolerances.min_trace_to_pad_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let spatialIndex=new SpatialObjectIndex({objects:pads,getBounds:getPadBounds,getId:pad2=>getPrimaryId(pad2)}),errors=new Map;for(let segment2 of segments){let nearbyPads=spatialIndex.getObjectsInBounds(getCollidableBounds(segment2),minClearance+segment2.thickness/2);for(let pad2 of nearbyPads){let padId=getPrimaryId(pad2);if(!getLayersOfPcbElement(pad2).includes(segment2.layer)||connMap.areIdsConnected(segment2.pcb_trace_id,padId))continue;let center2=getPadCenter(pad2),gap=isCircularPad(pad2)?segmentToCircleMinDistance({x:segment2.x1,y:segment2.y1},{x:segment2.x2,y:segment2.y2},{x:center2.x,y:center2.y,radius:getPadRadius(pad2)})-segment2.thickness/2:segmentToBoundsMinDistance({x:segment2.x1,y:segment2.y1},{x:segment2.x2,y:segment2.y2},getPadBounds(pad2))-segment2.thickness/2;if(gap+EPSILON2>=minClearance)continue;let pairId=`${padId}_${segment2.pcb_trace_id}`,nextError={type:"pcb_pad_trace_clearance_error",pcb_pad_trace_clearance_error_id:`pad_trace_clearance_${pairId}`,error_type:"pcb_pad_trace_clearance_error",message:`Pad ${getReadableNameForElement(circuitJson,padId)} and trace ${getReadableNameForElement(circuitJson,segment2.pcb_trace_id)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(minClearance)})`,pcb_pad_id:padId,pcb_trace_id:segment2.pcb_trace_id,minimum_clearance:minClearance,actual_clearance:gap,center:{x:(center2.x+(segment2.x1+segment2.x2)/2)/2,y:(center2.y+(segment2.y1+segment2.y2)/2)/2}},current3=errors.get(pairId);(!current3||gap<current3.gap)&&errors.set(pairId,{error:nextError,gap})}}return Array.from(errors.values()).map(({error:error2})=>error2)}var getClosestPointOnSegment=(point7,segmentStart,segmentEnd)=>{let dx3=segmentEnd.x-segmentStart.x,dy3=segmentEnd.y-segmentStart.y,lengthSquared=dx3*dx3+dy3*dy3;if(lengthSquared===0)return segmentStart;let t52=Math.max(0,Math.min(1,((point7.x-segmentStart.x)*dx3+(point7.y-segmentStart.y)*dy3)/lengthSquared));return{x:segmentStart.x+t52*dx3,y:segmentStart.y+t52*dy3}};function checkViaTraceClearance(circuitJson,{connMap,minClearance}={}){let vias=circuitJson.filter(el3=>el3.type==="pcb_via"),segments=getTraceSegments(circuitJson);if(vias.length===0||segments.length===0)return[];let board=getPcbBoard(circuitJson);minClearance??(minClearance=getBoardDrcValue(board,"min_trace_to_pad_edge_clearance")??jlcMinTolerances.min_trace_to_pad_edge_clearance),connMap??(connMap=getFullConnectivityMapFromCircuitJson(circuitJson));let errors=new Map;for(let via of vias){let viaRadius=via.outer_diameter/2;for(let segment2 of segments){if(!getLayersOfPcbElement(via).includes(segment2.layer)||connMap.areIdsConnected(segment2.pcb_trace_id,via.pcb_via_id))continue;let gap=segmentToCircleMinDistance({x:segment2.x1,y:segment2.y1},{x:segment2.x2,y:segment2.y2},{x:via.x,y:via.y,radius:viaRadius})-segment2.thickness/2;if(gap+EPSILON2>=minClearance)continue;let closestPoint=getClosestPointOnSegment({x:via.x,y:via.y},{x:segment2.x1,y:segment2.y1},{x:segment2.x2,y:segment2.y2}),pairId=`${via.pcb_via_id}_${segment2.pcb_trace_id}`,nextError={type:"pcb_via_trace_clearance_error",pcb_via_trace_clearance_error_id:`via_trace_clearance_${pairId}`,error_type:"pcb_via_trace_clearance_error",message:`Via ${getReadableNameForElement(circuitJson,via.pcb_via_id)} and trace ${getReadableNameForElement(circuitJson,segment2.pcb_trace_id)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(minClearance)})`,pcb_via_id:via.pcb_via_id,pcb_trace_id:segment2.pcb_trace_id,minimum_clearance:minClearance,actual_clearance:gap,center:{x:(via.x+closestPoint.x)/2,y:(via.y+closestPoint.y)/2}},current3=errors.get(pairId);(!current3||gap<current3.gap)&&errors.set(pairId,{error:nextError,gap})}}return Array.from(errors.values()).map(({error:error2})=>error2)}function checkPinMustBeConnected(circuitJson){let errors=[],sourceComponents=circuitJson.filter(el3=>"source_component_id"in el3&&(el3.type==="source_component"||el3.type.startsWith("source_simple_"))),sourcePorts=circuitJson.filter(el3=>el3.type==="source_port"),sourceTraces=circuitJson.filter(el3=>el3.type==="source_trace"),connectedPortIds=new Set;for(let trace of sourceTraces)for(let portId of trace.connected_source_port_ids??[])connectedPortIds.add(portId);let componentInternalConnections=new Map;for(let component of sourceComponents)"internally_connected_source_port_ids"in component&&component.internally_connected_source_port_ids&&componentInternalConnections.set(component.source_component_id,component.internally_connected_source_port_ids);for(let internalGroups of componentInternalConnections.values())for(let group of internalGroups)if(group.some(portId=>connectedPortIds.has(portId)))for(let portId of group)connectedPortIds.add(portId);for(let port of sourcePorts)if(port.must_be_connected===!0&&!connectedPortIds.has(port.source_port_id)){let componentName=sourceComponents.find(c4=>c4.source_component_id===port.source_component_id)?.name??"Unknown";errors.push({type:"source_pin_must_be_connected_error",source_pin_must_be_connected_error_id:`source_pin_must_be_connected_error_${port.source_port_id}`,error_type:"source_pin_must_be_connected_error",message:`Port ${port.name} on ${componentName} must be connected but is floating`,source_component_id:port.source_component_id??"",source_port_id:port.source_port_id,subcircuit_id:port.subcircuit_id})}return errors}var PIN_ATTRIBUTE_KEYS=["must_be_connected","provides_power","requires_power","provides_ground","requires_ground","provides_voltage","requires_voltage","do_not_connect","include_in_board_pinout","can_use_internal_pullup","is_using_internal_pullup","needs_external_pullup","can_use_internal_pulldown","is_using_internal_pulldown","needs_external_pulldown","can_use_open_drain","is_using_open_drain","can_use_push_pull","is_using_push_pull","should_have_decoupling_capacitor","recommended_decoupling_capacitor_capacitance","is_configured_for_i2c_sda","is_configured_for_i2c_scl","is_configured_for_spi_mosi","is_configured_for_spi_miso","is_configured_for_spi_sck","is_configured_for_spi_cs","is_configured_for_uart_tx","is_configured_for_uart_rx","supports_i2c_sda","supports_i2c_scl","supports_spi_mosi","supports_spi_miso","supports_spi_sck","supports_spi_cs","supports_uart_tx","supports_uart_rx"];function hasAnyPinAttribute(port){return PIN_ATTRIBUTE_KEYS.some(key=>port[key]!==void 0)}function checkAllPinsInComponentAreUnderspecified(circuitJson){let warnings=[],db2=cju_default(circuitJson),sourceComponents=db2.source_component.list(),sourcePorts=db2.source_port.list(),portsByComponent=new Map;for(let port of sourcePorts){if(!port.source_component_id)continue;let existing=portsByComponent.get(port.source_component_id)??[];existing.push(port),portsByComponent.set(port.source_component_id,existing)}for(let component of sourceComponents){if(component.ftype!=="simple_chip")continue;let componentPorts=portsByComponent.get(component.source_component_id)??[];componentPorts.length===0||componentPorts.some(port=>hasAnyPinAttribute(port))||warnings.push({type:"source_component_pins_underspecified_warning",source_component_pins_underspecified_warning_id:`source_component_pins_underspecified_warning_${component.source_component_id}`,warning_type:"source_component_pins_underspecified_warning",message:`All pins on ${component.name} are underspecified (no pinAttributes set)`,source_component_id:component.source_component_id,source_port_ids:componentPorts.map(port=>port.source_port_id),subcircuit_id:componentPorts[0]?.subcircuit_id})}return warnings}function checkNoPowerPinDefined(circuitJson){let warnings=[],db2=cju_default(circuitJson),sourceComponents=db2.source_component.list(),sourcePorts=db2.source_port.list(),portsByComponent=new Map;for(let port of sourcePorts){if(!port.source_component_id)continue;let existing=portsByComponent.get(port.source_component_id)??[];existing.push(port),portsByComponent.set(port.source_component_id,existing)}for(let component of sourceComponents){if(component.ftype!=="simple_chip")continue;let componentPorts=portsByComponent.get(component.source_component_id)??[];componentPorts.length===0||componentPorts.some(port=>port.requires_power===!0)||warnings.push({type:"source_no_power_pin_defined_warning",source_no_power_pin_defined_warning_id:`source_no_power_pin_defined_warning_${component.source_component_id}`,warning_type:"source_no_power_pin_defined_warning",message:`${component.name} has no pin with requires_power=true`,source_component_id:component.source_component_id,source_port_ids:componentPorts.map(port=>port.source_port_id),subcircuit_id:componentPorts[0]?.subcircuit_id})}return warnings}function checkNoGroundPinDefined(circuitJson){let warnings=[],db2=cju_default(circuitJson),sourceComponents=db2.source_component.list(),sourcePorts=db2.source_port.list(),portsByComponent=new Map;for(let port of sourcePorts){if(!port.source_component_id)continue;let existing=portsByComponent.get(port.source_component_id)??[];existing.push(port),portsByComponent.set(port.source_component_id,existing)}for(let component of sourceComponents){if(component.ftype!=="simple_chip")continue;let componentPorts=portsByComponent.get(component.source_component_id)??[];componentPorts.length===0||componentPorts.some(port=>port.requires_ground===!0)||warnings.push({type:"source_no_ground_pin_defined_warning",source_no_ground_pin_defined_warning_id:`source_no_ground_pin_defined_warning_${component.source_component_id}`,warning_type:"source_no_ground_pin_defined_warning",message:`${component.name} has no pin with requires_ground=true`,source_component_id:component.source_component_id,source_port_ids:componentPorts.map(port=>port.source_port_id),subcircuit_id:componentPorts[0]?.subcircuit_id})}return warnings}function getFacingDirectionFromInsertionDirection(component){switch(component.insertion_direction){case"from_left":return"x-";case"from_right":return"x+";case"from_front":return"y+";case"from_back":return"y-";case"from_above":return null;default:return null}}function getFacingDirection(component){if(component.insertion_direction)return getFacingDirectionFromInsertionDirection(component);if(!component.center||!component.cable_insertion_center)return null;let dx3=component.cable_insertion_center.x-component.center.x,dy3=component.cable_insertion_center.y-component.center.y;return Math.abs(dx3)<1e-6&&Math.abs(dy3)<1e-6?null:Math.abs(dx3)>=Math.abs(dy3)?dx3>=0?"x+":"x-":dy3>=0?"y+":"y-"}function getRecommendedFacingDirection(component,bounds){if(!component.center)return null;let distances=[{direction:"x-",distance:component.center.x-bounds.minX},{direction:"x+",distance:bounds.maxX-component.center.x},{direction:"y-",distance:component.center.y-bounds.minY},{direction:"y+",distance:bounds.maxY-component.center.y}];return distances.sort((a3,b3)=>a3.distance-b3.distance),distances[0]?.direction??null}function checkConnectorAccessibleOrientation(circuitJson){let board=circuitJson.find(el3=>el3.type==="pcb_board");if(!board)return[];let bounds=(()=>{try{return getBoardBounds(board)}catch{return null}})();if(!bounds)return[];let warnings=[],components=circuitJson.filter(el3=>el3.type==="pcb_component");for(let component of components){let facingDirection=getFacingDirection(component),recommendedFacingDirection=getRecommendedFacingDirection(component,bounds);if(!facingDirection||!recommendedFacingDirection||facingDirection===recommendedFacingDirection)continue;let componentName=getReadableNameForComponent(circuitJson,component.pcb_component_id);warnings.push({type:"pcb_connector_not_in_accessible_orientation_warning",warning_type:"pcb_connector_not_in_accessible_orientation_warning",pcb_connector_not_in_accessible_orientation_warning_id:`pcb_connector_not_in_accessible_orientation_warning_${component.pcb_component_id}`,message:`${componentName} is facing ${facingDirection} but should face ${recommendedFacingDirection} so the connector is accessible from the board edge`,pcb_component_id:component.pcb_component_id,source_component_id:component.source_component_id,pcb_board_id:board.pcb_board_id,facing_direction:facingDirection,recommended_facing_direction:recommendedFacingDirection,subcircuit_id:component.subcircuit_id})}return warnings}function getCourtyardPolygon(el3){if(el3.type==="pcb_courtyard_rect"){let hw3=el3.width/2,hh3=el3.height/2,corners=[{x:-hw3,y:-hh3},{x:+hw3,y:-hh3},{x:+hw3,y:+hh3},{x:-hw3,y:+hh3}],angle=(el3.ccw_rotation??0)*Math.PI/180,cos6=Math.cos(angle),sin6=Math.sin(angle);return corners.map(({x:x4,y:y4})=>({x:el3.center.x+x4*cos6-y4*sin6,y:el3.center.y+x4*sin6+y4*cos6}))}return el3.type==="pcb_courtyard_circle"?Array.from({length:32},(_4,i3)=>{let a3=2*Math.PI*i3/32;return{x:el3.center.x+el3.radius*Math.cos(a3),y:el3.center.y+el3.radius*Math.sin(a3)}}):el3.outline}function getComponentName2(circuitJson,pcbComponentId){let pcbComponent=circuitJson.find(el3=>el3.type==="pcb_component"&&el3.pcb_component_id===pcbComponentId);if(pcbComponent?.type!=="pcb_component")return pcbComponentId;let sourceComponent=circuitJson.find(el3=>el3.type==="source_component"&&el3.source_component_id===pcbComponent.source_component_id);return sourceComponent?.type==="source_component"&&sourceComponent.name?sourceComponent.name:pcbComponentId}function polygonsOverlap(polyA,polyB){if(polyA.some(p4=>isPointInsidePolygon(p4,polyB))||polyB.some(p4=>isPointInsidePolygon(p4,polyA)))return!0;for(let i3=0;i3<polyA.length;i3++){let a12=polyA[i3],a22=polyA[(i3+1)%polyA.length];for(let j4=0;j4<polyB.length;j4++){let b12=polyB[j4],b22=polyB[(j4+1)%polyB.length];if(doSegmentsIntersect(a12,a22,b12,b22))return!0}}return!1}function checkCourtyardOverlap(circuitJson){let courtyards=circuitJson.filter(el3=>el3.type==="pcb_courtyard_rect"||el3.type==="pcb_courtyard_circle"||el3.type==="pcb_courtyard_outline"),byComponent=new Map;for(let el3 of courtyards){let id2=el3.pcb_component_id;byComponent.has(id2)||byComponent.set(id2,[]),byComponent.get(id2).push(el3)}let componentIds=Array.from(byComponent.keys()),errors=[];for(let i3=0;i3<componentIds.length;i3++)for(let j4=i3+1;j4<componentIds.length;j4++){let idA=componentIds[i3],idB=componentIds[j4],overlapping=!1;outer:for(let a3 of byComponent.get(idA))for(let b3 of byComponent.get(idB)){if("layer"in a3&&"layer"in b3&&a3.layer!==b3.layer)continue;let polyA=getCourtyardPolygon(a3),polyB=getCourtyardPolygon(b3);if(polygonsOverlap(polyA,polyB)){overlapping=!0;break outer}}overlapping&&errors.push({type:"pcb_courtyard_overlap_error",pcb_error_id:`pcb_courtyard_overlap_${idA}_${idB}`,error_type:"pcb_courtyard_overlap_error",message:`Courtyard of ${getComponentName2(circuitJson,idA)} overlaps with courtyard of ${getComponentName2(circuitJson,idB)}`,pcb_component_ids:[idA,idB]})}return errors}function distance32(x12,y12,x22,y22){return Math.sqrt((x22-x12)**2+(y22-y12)**2)}function isPointInPad(point7,pad2){if(pad2.type==="pcb_smtpad"){if(pad2.shape==="circle")return distance32(point7.x,point7.y,pad2.x,pad2.y)<=pad2.radius;if(pad2.shape==="rect"){let halfWidth=pad2.width/2,halfHeight=pad2.height/2;return Math.abs(point7.x-pad2.x)<=halfWidth&&Math.abs(point7.y-pad2.y)<=halfHeight}if(pad2.shape==="rotated_rect"){let dx3=point7.x-pad2.x,dy3=point7.y-pad2.y,angle=-pad2.ccw_rotation,rotatedX=dx3*Math.cos(angle)-dy3*Math.sin(angle),rotatedY=dx3*Math.sin(angle)+dy3*Math.cos(angle);return Math.abs(rotatedX)<=pad2.width/2&&Math.abs(rotatedY)<=pad2.height/2}if(pad2.shape==="pill"){let halfWidth=pad2.width/2,halfHeight=pad2.height/2,radius=pad2.radius;if(Math.abs(point7.x-pad2.x)<=halfWidth-radius&&Math.abs(point7.y-pad2.y)<=halfHeight)return!0;let cornerX=Math.max(Math.abs(point7.x-pad2.x)-(halfWidth-radius),0),cornerY=Math.max(Math.abs(point7.y-pad2.y)-(halfHeight-radius),0);return cornerX*cornerX+cornerY*cornerY<=radius*radius}}if(pad2.type==="pcb_plated_hole"){if(pad2.shape==="circle")return distance32(point7.x,point7.y,pad2.x,pad2.y)<=pad2.outer_diameter/2;if(pad2.shape==="oval"||pad2.shape==="pill")return Math.abs(point7.x-pad2.x)<=pad2.outer_width/2&&Math.abs(point7.y-pad2.y)<=pad2.outer_height/2;if(pad2.shape==="circular_hole_with_rect_pad"||pad2.shape==="pill_hole_with_rect_pad")return Math.abs(point7.x-pad2.x)<=pad2.rect_pad_width/2&&Math.abs(point7.y-pad2.y)<=pad2.rect_pad_height/2}return!1}function checkTracesAreContiguous(circuitJson){let errors=[],pcbPorts=circuitJson.filter(el3=>el3.type==="pcb_port"),pcbTraces=circuitJson.filter(el3=>el3.type==="pcb_trace"),sourceTraces=circuitJson.filter(el3=>el3.type==="source_trace"),pcbSmtPads=circuitJson.filter(el3=>el3.type==="pcb_smtpad"),pcbPlatedHoles=circuitJson.filter(el3=>el3.type==="pcb_plated_hole"),padMap=new Map;for(let pad2 of pcbSmtPads)pad2.pcb_port_id&&padMap.set(pad2.pcb_port_id,pad2);for(let hole of pcbPlatedHoles)hole.pcb_port_id&&padMap.set(hole.pcb_port_id,hole);for(let trace of pcbTraces){if(trace.route.length===0)continue;let firstPoint=trace.route[0],lastPoint=trace.route[trace.route.length-1],sourceTrace=sourceTraces.find(st3=>st3.source_trace_id===trace.source_trace_id),expectedPorts=sourceTrace?pcbPorts.filter(port=>sourceTrace.connected_source_port_ids?.includes(port.source_port_id)):[];for(let i3=1;i3<trace.route.length-1;i3++){let prevPoint=trace.route[i3-1],currentPoint=trace.route[i3],nextPoint=trace.route[i3+1];if(currentPoint.route_type==="via"){let prevIsWire=prevPoint.route_type==="wire",nextIsWire=nextPoint.route_type==="wire";if(prevIsWire&&nextIsWire){let prevAligned=Math.abs(prevPoint.x-currentPoint.x)<.01&&Math.abs(prevPoint.y-currentPoint.y)<.01,nextAligned=Math.abs(nextPoint.x-currentPoint.x)<.01&&Math.abs(nextPoint.y-currentPoint.y)<.01;if(!prevAligned||!nextAligned){let traceName2=getReadableNameForPcbTrace(circuitJson,trace.pcb_trace_id);errors.push({type:"pcb_trace_error",message:`Via in trace [${traceName2}] is misaligned at position {x: ${currentPoint.x}, y: ${currentPoint.y}}.`,source_trace_id:sourceTrace?.source_trace_id||trace.source_trace_id||`!${trace.pcb_trace_id}`,error_type:"pcb_trace_error",pcb_trace_id:trace.pcb_trace_id,pcb_trace_error_id:`misaligned_via_${trace.pcb_trace_id}_${i3}`,pcb_component_ids:[],pcb_port_ids:[]})}}}}let traceName=getReadableNameForPcbTrace(circuitJson,trace.pcb_trace_id);for(let port of expectedPorts){if(!port.pcb_port_id)continue;let pad2=padMap.get(port.pcb_port_id);if(!pad2)continue;let isFirstPointConnected=firstPoint.route_type==="wire"&&isPointInPad({x:firstPoint.x,y:firstPoint.y},pad2),isLastPointConnected=lastPoint.route_type==="wire"&&isPointInPad({x:lastPoint.x,y:lastPoint.y},pad2);if(!isFirstPointConnected&&!isLastPointConnected){let portName=getReadableNameForPcbPort(circuitJson,port.pcb_port_id).replace("pcb_port",""),padType=pad2.type.replace(/pcb_/,""),errorCenter={x:(firstPoint.x+lastPoint.x)/2,y:(firstPoint.y+lastPoint.y)/2};errors.push({type:"pcb_trace_error",message:`Trace [${traceName}] is missing a connection to ${padType}${portName}`,source_trace_id:sourceTrace?.source_trace_id||trace.source_trace_id||`!${trace.pcb_trace_id}`,error_type:"pcb_trace_error",pcb_trace_id:trace.pcb_trace_id,pcb_trace_error_id:`missing_connection_${trace.pcb_trace_id}_${port.pcb_port_id}`,center:errorCenter,pcb_component_ids:[],pcb_port_ids:[port.pcb_port_id]})}}if(expectedPorts.length===0){let firstConnectsToAnyPad=!1,lastConnectsToAnyPad=!1,endpointsAreSame=firstPoint.route_type==="wire"&&lastPoint.route_type==="wire"&&Math.abs(firstPoint.x-lastPoint.x)<.01&&Math.abs(firstPoint.y-lastPoint.y)<.01;for(let[portId,pad2]of padMap)firstPoint.route_type==="wire"&&isPointInPad({x:firstPoint.x,y:firstPoint.y},pad2)&&(firstConnectsToAnyPad=!0),lastPoint.route_type==="wire"&&isPointInPad({x:lastPoint.x,y:lastPoint.y},pad2)&&(lastConnectsToAnyPad=!0);!firstConnectsToAnyPad&&firstPoint.route_type==="wire"&&errors.push({type:"pcb_trace_error",message:`Trace [${traceName}] has disconnected endpoint at (${firstPoint.x.toFixed(2)}, ${firstPoint.y.toFixed(2)})`,source_trace_id:sourceTrace?.source_trace_id||trace.source_trace_id||`!${trace.pcb_trace_id}`,error_type:"pcb_trace_error",pcb_trace_id:trace.pcb_trace_id,pcb_trace_error_id:`disconnected_endpoint_${trace.pcb_trace_id}_start`,center:{x:firstPoint.x,y:firstPoint.y},pcb_component_ids:[],pcb_port_ids:[]}),!lastConnectsToAnyPad&&lastPoint.route_type==="wire"&&!(endpointsAreSame&&!firstConnectsToAnyPad)&&errors.push({type:"pcb_trace_error",message:`Trace [${traceName}] has disconnected endpoint at (${lastPoint.x.toFixed(2)}, ${lastPoint.y.toFixed(2)})`,source_trace_id:sourceTrace?.source_trace_id||trace.source_trace_id||`!${trace.pcb_trace_id}`,error_type:"pcb_trace_error",pcb_trace_id:trace.pcb_trace_id,pcb_trace_error_id:`disconnected_endpoint_${trace.pcb_trace_id}_end`,center:{x:lastPoint.x,y:lastPoint.y},pcb_component_ids:[],pcb_port_ids:[]})}}return errors}async function runAllPlacementChecks(circuitJson){return[...checkViasOffBoard(circuitJson),...checkPcbComponentsOutOfBoard(circuitJson),...checkPcbComponentOverlap(circuitJson),...checkPadPadClearance(circuitJson),...checkPadTraceClearance(circuitJson),...checkCourtyardOverlap(circuitJson),...checkConnectorAccessibleOrientation(circuitJson)]}async function runAllNetlistChecks(circuitJson){return[...checkPinMustBeConnected(circuitJson)]}async function runAllPinSpecificationChecks(circuitJson){return[...checkAllPinsInComponentAreUnderspecified(circuitJson),...checkNoPowerPinDefined(circuitJson),...checkNoGroundPinDefined(circuitJson)]}async function runAllRoutingChecks(circuitJson){return[...checkEachPcbPortConnectedToPcbTraces(circuitJson),...checkSourceTracesHavePcbTraces(circuitJson),...checkEachPcbTraceNonOverlapping(circuitJson),...checkViaTraceClearance(circuitJson),...checkSameNetViaSpacing(circuitJson),...checkDifferentNetViaSpacing(circuitJson),...checkTracesAreContiguous(circuitJson),...checkPcbTracesOutOfBoard(circuitJson)]}init_dist6();var SI_PREFIXES=[{value:1e12,symbol:"T"},{value:1e9,symbol:"G"},{value:1e6,symbol:"M"},{value:1e3,symbol:"k"},{value:1,symbol:""},{value:.001,symbol:"m"},{value:1e-6,symbol:"\xB5"},{value:1e-9,symbol:"n"},{value:1e-12,symbol:"p"}];function formatSiUnit(value){if(value==null)return"";if(value===0)return"0";let absValue=Math.abs(value),prefix=SI_PREFIXES.find(p4=>{let scaled2=absValue/p4.value;return scaled2>=1&&scaled2<1e3})||SI_PREFIXES[SI_PREFIXES.length-1],formatted=(value/prefix.value).toPrecision(3);return formatted.includes(".")&&!/\.0+$/.test(formatted)&&(formatted=formatted.replace(/0+$/,"")),formatted=formatted.replace(/\.0+$/,""),`${formatted}${prefix.symbol}`}init_dist6();init_dist();var FlatQueue=class{constructor(){this.ids=[],this.values=[],this.length=0}clear(){this.length=0}push(item,priority){let pos=this.length++;for(;pos>0;){let parent=pos-1>>1,parentValue=this.values[parent];if(priority>=parentValue)break;this.ids[pos]=this.ids[parent],this.values[pos]=parentValue,pos=parent}this.ids[pos]=item,this.values[pos]=priority}pop(){if(this.length===0)return;let ids=this.ids,values=this.values,top=ids[0],last=--this.length;if(last>0){let id2=ids[last],value=values[last],pos=0,halfLen=last>>1;for(;pos<halfLen;){let left=(pos<<1)+1,right=left+1,child=left+(+(right<last)&+(values[right]<values[left]));if(values[child]>=value)break;ids[pos]=ids[child],values[pos]=values[child],pos=child}ids[pos]=id2,values[pos]=value}return top}peek(){return this.length>0?this.ids[0]:void 0}peekValue(){return this.length>0?this.values[0]:void 0}shrink(){this.ids.length=this.values.length=this.length}};var ARRAY_TYPES=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],VERSION=3,Flatbush=class _Flatbush{static from(data,byteOffset=0){if(byteOffset%8!==0)throw new Error("byteOffset must be 8-byte aligned.");if(!data||data.byteLength===void 0||data.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[magic,versionAndType]=new Uint8Array(data,byteOffset+0,2);if(magic!==251)throw new Error("Data does not appear to be in a Flatbush format.");let version2=versionAndType>>4;if(version2!==VERSION)throw new Error(`Got v${version2} data when expected v${VERSION}.`);let ArrayType=ARRAY_TYPES[versionAndType&15];if(!ArrayType)throw new Error("Unrecognized array type.");let[nodeSize]=new Uint16Array(data,byteOffset+2,1),[numItems]=new Uint32Array(data,byteOffset+4,1);return new _Flatbush(numItems,nodeSize,ArrayType,void 0,data,byteOffset)}constructor(numItems,nodeSize=16,ArrayType=Float64Array,ArrayBufferType=ArrayBuffer,data,byteOffset=0){if(numItems===void 0)throw new Error("Missing required argument: numItems.");if(isNaN(numItems)||numItems<=0)throw new Error(`Unexpected numItems value: ${numItems}.`);this.numItems=+numItems,this.nodeSize=Math.min(Math.max(+nodeSize,2),65535),this.byteOffset=byteOffset;let n4=numItems,numNodes=n4;this._levelBounds=[n4*4];do n4=Math.ceil(n4/this.nodeSize),numNodes+=n4,this._levelBounds.push(numNodes*4);while(n4!==1);this.ArrayType=ArrayType,this.IndexArrayType=numNodes<16384?Uint16Array:Uint32Array;let arrayTypeIndex=ARRAY_TYPES.indexOf(ArrayType),nodesByteSize=numNodes*4*ArrayType.BYTES_PER_ELEMENT;if(arrayTypeIndex<0)throw new Error(`Unexpected typed array class: ${ArrayType}.`);if(data)this.data=data,this._boxes=new ArrayType(data,byteOffset+8,numNodes*4),this._indices=new this.IndexArrayType(data,byteOffset+8+nodesByteSize,numNodes),this._pos=numNodes*4,this.minX=this._boxes[this._pos-4],this.minY=this._boxes[this._pos-3],this.maxX=this._boxes[this._pos-2],this.maxY=this._boxes[this._pos-1];else{let data2=this.data=new ArrayBufferType(8+nodesByteSize+numNodes*this.IndexArrayType.BYTES_PER_ELEMENT);this._boxes=new ArrayType(data2,8,numNodes*4),this._indices=new this.IndexArrayType(data2,8+nodesByteSize,numNodes),this._pos=0,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,new Uint8Array(data2,0,2).set([251,(VERSION<<4)+arrayTypeIndex]),new Uint16Array(data2,2,1)[0]=nodeSize,new Uint32Array(data2,4,1)[0]=numItems}this._queue=new FlatQueue}add(minX,minY,maxX=minX,maxY=minY){let index=this._pos>>2,boxes=this._boxes;return this._indices[index]=index,boxes[this._pos++]=minX,boxes[this._pos++]=minY,boxes[this._pos++]=maxX,boxes[this._pos++]=maxY,minX<this.minX&&(this.minX=minX),minY<this.minY&&(this.minY=minY),maxX>this.maxX&&(this.maxX=maxX),maxY>this.maxY&&(this.maxY=maxY),index}finish(){if(this._pos>>2!==this.numItems)throw new Error(`Added ${this._pos>>2} items when expected ${this.numItems}.`);let boxes=this._boxes;if(this.numItems<=this.nodeSize){boxes[this._pos++]=this.minX,boxes[this._pos++]=this.minY,boxes[this._pos++]=this.maxX,boxes[this._pos++]=this.maxY;return}let width=this.maxX-this.minX||1,height=this.maxY-this.minY||1,hilbertValues=new Uint32Array(this.numItems),hilbertMax=65535;for(let i3=0,pos=0;i3<this.numItems;i3++){let minX=boxes[pos++],minY=boxes[pos++],maxX=boxes[pos++],maxY=boxes[pos++],x4=Math.floor(hilbertMax*((minX+maxX)/2-this.minX)/width),y4=Math.floor(hilbertMax*((minY+maxY)/2-this.minY)/height);hilbertValues[i3]=hilbert(x4,y4)}sort(hilbertValues,boxes,this._indices,0,this.numItems-1,this.nodeSize);for(let i3=0,pos=0;i3<this._levelBounds.length-1;i3++){let end=this._levelBounds[i3];for(;pos<end;){let nodeIndex=pos,nodeMinX=boxes[pos++],nodeMinY=boxes[pos++],nodeMaxX=boxes[pos++],nodeMaxY=boxes[pos++];for(let j4=1;j4<this.nodeSize&&pos<end;j4++)nodeMinX=Math.min(nodeMinX,boxes[pos++]),nodeMinY=Math.min(nodeMinY,boxes[pos++]),nodeMaxX=Math.max(nodeMaxX,boxes[pos++]),nodeMaxY=Math.max(nodeMaxY,boxes[pos++]);this._indices[this._pos>>2]=nodeIndex,boxes[this._pos++]=nodeMinX,boxes[this._pos++]=nodeMinY,boxes[this._pos++]=nodeMaxX,boxes[this._pos++]=nodeMaxY}}}search(minX,minY,maxX,maxY,filterFn){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let nodeIndex=this._boxes.length-4,queue=[],results=[];for(;nodeIndex!==void 0;){let end=Math.min(nodeIndex+this.nodeSize*4,upperBound(nodeIndex,this._levelBounds));for(let pos=nodeIndex;pos<end;pos+=4){let x02=this._boxes[pos];if(maxX<x02)continue;let y02=this._boxes[pos+1];if(maxY<y02)continue;let x12=this._boxes[pos+2];if(minX>x12)continue;let y12=this._boxes[pos+3];if(minY>y12)continue;let index=this._indices[pos>>2]|0;nodeIndex>=this.numItems*4?queue.push(index):(filterFn===void 0||filterFn(index,x02,y02,x12,y12))&&results.push(index)}nodeIndex=queue.pop()}return results}neighbors(x4,y4,maxResults=1/0,maxDistance=1/0,filterFn){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let nodeIndex=this._boxes.length-4,q4=this._queue,results=[],maxDistSquared=maxDistance*maxDistance;outer:for(;nodeIndex!==void 0;){let end=Math.min(nodeIndex+this.nodeSize*4,upperBound(nodeIndex,this._levelBounds));for(let pos=nodeIndex;pos<end;pos+=4){let index=this._indices[pos>>2]|0,minX=this._boxes[pos],minY=this._boxes[pos+1],maxX=this._boxes[pos+2],maxY=this._boxes[pos+3],dx3=x4<minX?minX-x4:x4>maxX?x4-maxX:0,dy3=y4<minY?minY-y4:y4>maxY?y4-maxY:0,dist=dx3*dx3+dy3*dy3;dist>maxDistSquared||(nodeIndex>=this.numItems*4?q4.push(index<<1,dist):(filterFn===void 0||filterFn(index))&&q4.push((index<<1)+1,dist))}for(;q4.length&&q4.peek()&1;)if(q4.peekValue()>maxDistSquared||(results.push(q4.pop()>>1),results.length===maxResults))break outer;nodeIndex=q4.length?q4.pop()>>1:void 0}return q4.clear(),results}};function upperBound(value,arr){let i3=0,j4=arr.length-1;for(;i3<j4;){let m4=i3+j4>>1;arr[m4]>value?j4=m4:i3=m4+1}return arr[i3]}function sort(values,boxes,indices,left,right,nodeSize){let stack=[left,right];for(;stack.length;){let r5=stack.pop()||0,l4=stack.pop()||0;if(r5-l4<=nodeSize&&Math.floor(l4/nodeSize)>=Math.floor(r5/nodeSize))continue;let a3=values[l4],b3=values[l4+r5>>1],c4=values[r5],pivot=a3>b3!=a3>c4?a3:b3<a3!=b3<c4?b3:c4,i3=l4-1,j4=r5+1;for(;;){do i3++;while(values[i3]<pivot);do j4--;while(values[j4]>pivot);if(i3>=j4)break;swap(values,boxes,indices,i3,j4)}stack.push(l4,j4,j4+1,r5)}}function swap(values,boxes,indices,i3,j4){let temp=values[i3];values[i3]=values[j4],values[j4]=temp;let k4=4*i3,m4=4*j4,a3=boxes[k4],b3=boxes[k4+1],c4=boxes[k4+2],d4=boxes[k4+3];boxes[k4]=boxes[m4],boxes[k4+1]=boxes[m4+1],boxes[k4+2]=boxes[m4+2],boxes[k4+3]=boxes[m4+3],boxes[m4]=a3,boxes[m4+1]=b3,boxes[m4+2]=c4,boxes[m4+3]=d4;let e5=indices[i3];indices[i3]=indices[j4],indices[j4]=e5}function hilbert(x4,y4){let a3=x4^y4,b3=65535^a3,c4=65535^(x4|y4),d4=x4&(y4^65535),A4=a3|b3>>1,B4=a3>>1^a3,C4=c4>>1^b3&d4>>1^c4,D4=a3&c4>>1^d4>>1^d4;a3=A4,b3=B4,c4=C4,d4=D4,A4=a3&a3>>2^b3&b3>>2,B4=a3&b3>>2^b3&(a3^b3)>>2,C4^=a3&c4>>2^b3&d4>>2,D4^=b3&c4>>2^(a3^b3)&d4>>2,a3=A4,b3=B4,c4=C4,d4=D4,A4=a3&a3>>4^b3&b3>>4,B4=a3&b3>>4^b3&(a3^b3)>>4,C4^=a3&c4>>4^b3&d4>>4,D4^=b3&c4>>4^(a3^b3)&d4>>4,a3=A4,b3=B4,c4=C4,d4=D4,C4^=a3&c4>>8^b3&d4>>8,D4^=b3&c4>>8^(a3^b3)&d4>>8,a3=C4^C4>>1,b3=D4^D4>>1;let i02=x4^y4,i12=b3|65535^(i02|a3);return i02=(i02|i02<<8)&16711935,i02=(i02|i02<<4)&252645135,i02=(i02|i02<<2)&858993459,i02=(i02|i02<<1)&1431655765,i12=(i12|i12<<8)&16711935,i12=(i12|i12<<4)&252645135,i12=(i12|i12<<2)&858993459,i12=(i12|i12<<1)&1431655765,(i12<<1|i02)>>>0}var __create2=Object.create,__defProp3=Object.defineProperty,__getOwnPropDesc2=Object.getOwnPropertyDescriptor,__getOwnPropNames2=Object.getOwnPropertyNames,__getProtoOf2=Object.getPrototypeOf,__hasOwnProp2=Object.prototype.hasOwnProperty,__commonJS2=(cb3,mod)=>function(){return mod||(0,cb3[__getOwnPropNames2(cb3)[0]])((mod={exports:{}}).exports,mod),mod.exports},__copyProps2=(to3,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames2(from))!__hasOwnProp2.call(to3,key)&&key!==except&&__defProp3(to3,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc2(from,key))||desc.enumerable});return to3},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create2(__getProtoOf2(mod)):{},__copyProps2(isNodeMode||!mod||!mod.__esModule?__defProp3(target,"default",{value:mod,enumerable:!0}):target,mod)),require_is_buffer=__commonJS2({"node_modules/is-buffer/index.js"(exports,module){"use strict";module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer=="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE=="function"&&typeof obj.slice=="function"&&isBuffer(obj.slice(0,0))}}}),require_kind_of=__commonJS2({"node_modules/kind-of/index.js"(exports,module){"use strict";var isBuffer=require_is_buffer(),toString3=Object.prototype.toString;module.exports=function(val){if(typeof val>"u")return"undefined";if(val===null)return"null";if(val===!0||val===!1||val instanceof Boolean)return"boolean";if(typeof val=="string"||val instanceof String)return"string";if(typeof val=="number"||val instanceof Number)return"number";if(typeof val=="function"||val instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(val))return"array";if(val instanceof RegExp)return"regexp";if(val instanceof Date)return"date";var type=toString3.call(val);return type==="[object RegExp]"?"regexp":type==="[object Date]"?"date":type==="[object Arguments]"?"arguments":type==="[object Error]"?"error":isBuffer(val)?"buffer":type==="[object Set]"?"set":type==="[object WeakSet]"?"weakset":type==="[object Map]"?"map":type==="[object WeakMap]"?"weakmap":type==="[object Symbol]"?"symbol":type==="[object Int8Array]"?"int8array":type==="[object Uint8Array]"?"uint8array":type==="[object Uint8ClampedArray]"?"uint8clampedarray":type==="[object Int16Array]"?"int16array":type==="[object Uint16Array]"?"uint16array":type==="[object Int32Array]"?"int32array":type==="[object Uint32Array]"?"uint32array":type==="[object Float32Array]"?"float32array":type==="[object Float64Array]"?"float64array":"object"}}}),require_rename_keys=__commonJS2({"node_modules/rename-keys/index.js"(exports,module){"use strict";(function(){"use strict";function rename2(obj,fn3){if(typeof fn3!="function")return obj;var res2={};for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(res2[fn3(key,obj[key])||key]=obj[key]);return res2}typeof module<"u"&&module.exports?module.exports=rename2:typeof define=="function"&&define.amd?define([],function(){return rename2}):window.rename=rename2})()}}),require_deep_rename_keys=__commonJS2({"node_modules/deep-rename-keys/index.js"(exports,module){"use strict";var typeOf=require_kind_of(),rename2=require_rename_keys();module.exports=function renameDeep(obj,cb3){var type=typeOf(obj);if(type!=="object"&&type!=="array")throw new Error("expected an object");var res2=[];type==="object"&&(obj=rename2(obj,cb3),res2={});for(var key in obj)if(obj.hasOwnProperty(key)){var val=obj[key];typeOf(val)==="object"||typeOf(val)==="array"?res2[key]=renameDeep(val,cb3):res2[key]=val}return res2}}}),require_eventemitter3=__commonJS2({"node_modules/eventemitter3/index.js"(exports,module){"use strict";var has=Object.prototype.hasOwnProperty,prefix="~";function Events(){}Object.create&&(Events.prototype=Object.create(null),new Events().__proto__||(prefix=!1));function EE3(fn3,context,once){this.fn=fn3,this.context=context,this.once=once||!1}function EventEmitter(){this._events=new Events,this._eventsCount=0}EventEmitter.prototype.eventNames=function(){var names=[],events,name;if(this._eventsCount===0)return names;for(name in events=this._events)has.call(events,name)&&names.push(prefix?name.slice(1):name);return Object.getOwnPropertySymbols?names.concat(Object.getOwnPropertySymbols(events)):names},EventEmitter.prototype.listeners=function(event,exists){var evt=prefix?prefix+event:event,available=this._events[evt];if(exists)return!!available;if(!available)return[];if(available.fn)return[available.fn];for(var i3=0,l4=available.length,ee3=new Array(l4);i3<l4;i3++)ee3[i3]=available[i3].fn;return ee3},EventEmitter.prototype.emit=function(event,a12,a22,a3,a4,a52){var evt=prefix?prefix+event:event;if(!this._events[evt])return!1;var listeners=this._events[evt],len=arguments.length,args,i3;if(listeners.fn){switch(listeners.once&&this.removeListener(event,listeners.fn,void 0,!0),len){case 1:return listeners.fn.call(listeners.context),!0;case 2:return listeners.fn.call(listeners.context,a12),!0;case 3:return listeners.fn.call(listeners.context,a12,a22),!0;case 4:return listeners.fn.call(listeners.context,a12,a22,a3),!0;case 5:return listeners.fn.call(listeners.context,a12,a22,a3,a4),!0;case 6:return listeners.fn.call(listeners.context,a12,a22,a3,a4,a52),!0}for(i3=1,args=new Array(len-1);i3<len;i3++)args[i3-1]=arguments[i3];listeners.fn.apply(listeners.context,args)}else{var length22=listeners.length,j4;for(i3=0;i3<length22;i3++)switch(listeners[i3].once&&this.removeListener(event,listeners[i3].fn,void 0,!0),len){case 1:listeners[i3].fn.call(listeners[i3].context);break;case 2:listeners[i3].fn.call(listeners[i3].context,a12);break;case 3:listeners[i3].fn.call(listeners[i3].context,a12,a22);break;case 4:listeners[i3].fn.call(listeners[i3].context,a12,a22,a3);break;default:if(!args)for(j4=1,args=new Array(len-1);j4<len;j4++)args[j4-1]=arguments[j4];listeners[i3].fn.apply(listeners[i3].context,args)}}return!0},EventEmitter.prototype.on=function(event,fn3,context){var listener=new EE3(fn3,context||this),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.once=function(event,fn3,context){var listener=new EE3(fn3,context||this,!0),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.removeListener=function(event,fn3,context,once){var evt=prefix?prefix+event:event;if(!this._events[evt])return this;if(!fn3)return--this._eventsCount===0?this._events=new Events:delete this._events[evt],this;var listeners=this._events[evt];if(listeners.fn)listeners.fn===fn3&&(!once||listeners.once)&&(!context||listeners.context===context)&&(--this._eventsCount===0?this._events=new Events:delete this._events[evt]);else{for(var i3=0,events=[],length22=listeners.length;i3<length22;i3++)(listeners[i3].fn!==fn3||once&&!listeners[i3].once||context&&listeners[i3].context!==context)&&events.push(listeners[i3]);events.length?this._events[evt]=events.length===1?events[0]:events:--this._eventsCount===0?this._events=new Events:delete this._events[evt]}return this},EventEmitter.prototype.removeAllListeners=function(event){var evt;return event?(evt=prefix?prefix+event:event,this._events[evt]&&(--this._eventsCount===0?this._events=new Events:delete this._events[evt])):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prototype.setMaxListeners=function(){return this},EventEmitter.prefixed=prefix,EventEmitter.EventEmitter=EventEmitter,typeof module<"u"&&(module.exports=EventEmitter)}}),require_lexer=__commonJS2({"node_modules/xml-lexer/dist/lexer.js"(exports,module){"use strict";function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}var EventEmitter=require_eventemitter3(),noop=function(){},State2={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},Action={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},Type={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},charToAction={" ":Action.space," ":Action.space,"\n":Action.space,"\r":Action.space,"<":Action.lt,">":Action.gt,'"':Action.quote,"'":Action.quote,"=":Action.equal,"/":Action.slash},getAction=function(char){return charToAction[char]||Action.char},create=function(options){var _State$data,_State$tagBegin,_State$tagName,_State$tagEnd,_State$attributeNameS,_State$attributeName,_State$attributeNameE,_State$attributeValue,_State$attributeValue2,_lexer$stateMachine;options=Object.assign({debug:!1},options);var lexer=new EventEmitter,state2=State2.data,data="",tagName="",attrName="",attrValue="",isClosing="",openingQuote="",emit=function(type,value){if(!(tagName[0]==="?"||tagName[0]==="!")){var event={type,value};options.debug&&console.log("emit:",event),lexer.emit("data",event)}};lexer.stateMachine=(_lexer$stateMachine={},_defineProperty(_lexer$stateMachine,State2.data,(_State$data={},_defineProperty(_State$data,Action.lt,function(){data.trim()&&emit(Type.text,data),tagName="",isClosing=!1,state2=State2.tagBegin}),_defineProperty(_State$data,Action.char,function(char){data+=char}),_State$data)),_defineProperty(_lexer$stateMachine,State2.cdata,_defineProperty({},Action.char,function(char){data+=char,data.substr(-3)==="]]>"&&(emit(Type.text,data.slice(0,-3)),data="",state2=State2.data)})),_defineProperty(_lexer$stateMachine,State2.tagBegin,(_State$tagBegin={},_defineProperty(_State$tagBegin,Action.space,noop),_defineProperty(_State$tagBegin,Action.char,function(char){tagName=char,state2=State2.tagName}),_defineProperty(_State$tagBegin,Action.slash,function(){tagName="",isClosing=!0}),_State$tagBegin)),_defineProperty(_lexer$stateMachine,State2.tagName,(_State$tagName={},_defineProperty(_State$tagName,Action.space,function(){isClosing?state2=State2.tagEnd:(state2=State2.attributeNameStart,emit(Type.openTag,tagName))}),_defineProperty(_State$tagName,Action.gt,function(){emit(isClosing?Type.closeTag:Type.openTag,tagName),data="",state2=State2.data}),_defineProperty(_State$tagName,Action.slash,function(){state2=State2.tagEnd,emit(Type.openTag,tagName)}),_defineProperty(_State$tagName,Action.char,function(char){tagName+=char,tagName==="![CDATA["&&(state2=State2.cdata,data="",tagName="")}),_State$tagName)),_defineProperty(_lexer$stateMachine,State2.tagEnd,(_State$tagEnd={},_defineProperty(_State$tagEnd,Action.gt,function(){emit(Type.closeTag,tagName),data="",state2=State2.data}),_defineProperty(_State$tagEnd,Action.char,noop),_State$tagEnd)),_defineProperty(_lexer$stateMachine,State2.attributeNameStart,(_State$attributeNameS={},_defineProperty(_State$attributeNameS,Action.char,function(char){attrName=char,state2=State2.attributeName}),_defineProperty(_State$attributeNameS,Action.gt,function(){data="",state2=State2.data}),_defineProperty(_State$attributeNameS,Action.space,noop),_defineProperty(_State$attributeNameS,Action.slash,function(){isClosing=!0,state2=State2.tagEnd}),_State$attributeNameS)),_defineProperty(_lexer$stateMachine,State2.attributeName,(_State$attributeName={},_defineProperty(_State$attributeName,Action.space,function(){state2=State2.attributeNameEnd}),_defineProperty(_State$attributeName,Action.equal,function(){emit(Type.attributeName,attrName),state2=State2.attributeValueBegin}),_defineProperty(_State$attributeName,Action.gt,function(){attrValue="",emit(Type.attributeName,attrName),emit(Type.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeName,Action.slash,function(){isClosing=!0,attrValue="",emit(Type.attributeName,attrName),emit(Type.attributeValue,attrValue),state2=State2.tagEnd}),_defineProperty(_State$attributeName,Action.char,function(char){attrName+=char}),_State$attributeName)),_defineProperty(_lexer$stateMachine,State2.attributeNameEnd,(_State$attributeNameE={},_defineProperty(_State$attributeNameE,Action.space,noop),_defineProperty(_State$attributeNameE,Action.equal,function(){emit(Type.attributeName,attrName),state2=State2.attributeValueBegin}),_defineProperty(_State$attributeNameE,Action.gt,function(){attrValue="",emit(Type.attributeName,attrName),emit(Type.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeNameE,Action.char,function(char){attrValue="",emit(Type.attributeName,attrName),emit(Type.attributeValue,attrValue),attrName=char,state2=State2.attributeName}),_State$attributeNameE)),_defineProperty(_lexer$stateMachine,State2.attributeValueBegin,(_State$attributeValue={},_defineProperty(_State$attributeValue,Action.space,noop),_defineProperty(_State$attributeValue,Action.quote,function(char){openingQuote=char,attrValue="",state2=State2.attributeValue}),_defineProperty(_State$attributeValue,Action.gt,function(){attrValue="",emit(Type.attributeValue,attrValue),data="",state2=State2.data}),_defineProperty(_State$attributeValue,Action.char,function(char){openingQuote="",attrValue=char,state2=State2.attributeValue}),_State$attributeValue)),_defineProperty(_lexer$stateMachine,State2.attributeValue,(_State$attributeValue2={},_defineProperty(_State$attributeValue2,Action.space,function(char){openingQuote?attrValue+=char:(emit(Type.attributeValue,attrValue),state2=State2.attributeNameStart)}),_defineProperty(_State$attributeValue2,Action.quote,function(char){openingQuote===char?(emit(Type.attributeValue,attrValue),state2=State2.attributeNameStart):attrValue+=char}),_defineProperty(_State$attributeValue2,Action.gt,function(char){openingQuote?attrValue+=char:(emit(Type.attributeValue,attrValue),data="",state2=State2.data)}),_defineProperty(_State$attributeValue2,Action.slash,function(char){openingQuote?attrValue+=char:(emit(Type.attributeValue,attrValue),isClosing=!0,state2=State2.tagEnd)}),_defineProperty(_State$attributeValue2,Action.char,function(char){attrValue+=char}),_State$attributeValue2)),_lexer$stateMachine);var step=function(char){options.debug&&console.log(state2,char);var actions=lexer.stateMachine[state2],action=actions[getAction(char)]||actions[Action.error]||actions[Action.char];action(char)};return lexer.write=function(str){for(var len=str.length,i3=0;i3<len;i3++)step(str[i3])},lexer};module.exports={State:State2,Action,Type,create}}}),require_reader=__commonJS2({"node_modules/xml-reader/dist/reader.js"(exports,module){"use strict";var EventEmitter=require_eventemitter3(),Lexer=require_lexer(),Type=Lexer.Type,NodeType={element:"element",text:"text"},createNode=function(params){return Object.assign({name:"",type:NodeType.element,value:"",parent:null,attributes:{},children:[]},params)},create=function(options){options=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},options);var lexer=void 0,rootNode=void 0,current3=void 0,attrName=void 0,reader=new EventEmitter,handleLexerData=function(data){switch(data.type){case Type.openTag:if(current3===null)current3=rootNode,current3.name=data.value;else{var node=createNode({name:data.value,parent:current3});current3.children.push(node),current3=node}break;case Type.closeTag:var parent=current3.parent;if(options.parentNodes||(current3.parent=null),current3.name!==data.value)break;options.stream&&parent===rootNode&&(rootNode.children=[],current3.parent=null),(!options.emitTopLevelOnly||parent===rootNode)&&(reader.emit(options.tagPrefix+current3.name,current3),reader.emit("tag",current3.name,current3)),current3===rootNode&&(lexer.removeAllListeners("data"),reader.emit(options.doneEvent,current3),rootNode=null),current3=parent;break;case Type.text:current3&¤t3.children.push(createNode({type:NodeType.text,value:data.value,parent:options.parentNodes?current3:null}));break;case Type.attributeName:attrName=data.value,current3.attributes[attrName]="";break;case Type.attributeValue:current3.attributes[attrName]=data.value;break}};return reader.reset=function(){lexer=Lexer.create({debug:options.debug}),lexer.on("data",handleLexerData),rootNode=createNode(),current3=null,attrName="",reader.parse=lexer.write},reader.reset(),reader},parseSync2=function(xml,options){options=Object.assign({},options,{stream:!1,tagPrefix:":"});var reader=create(options),res2=void 0;return reader.on("done",function(ast){res2=ast}),reader.parse(xml),res2};module.exports={parseSync:parseSync2,create,NodeType}}});function computeGridToAffineTransform(params){let{originX,originY,rows,cols,cellSizeMm,width,height}=params,a3,c4;cols>1?(a3=width/((cols-1)*cellSizeMm),c4=originX*(1-a3)-.5*cellSizeMm*a3):(a3=1,c4=originX+width/2-(originX+.5*cellSizeMm));let e5,f3;return rows>1?(e5=height/((rows-1)*cellSizeMm),f3=originY*(1-e5)-.5*cellSizeMm*e5):(e5=1,f3=originY+height/2-(originY+.5*cellSizeMm)),{a:a3,b:0,c:c4,d:0,e:e5,f:f3}}function applyAffineTransformToPoint(t52,p4){return{x:t52.a*p4.x+t52.b*p4.y+t52.c,y:t52.d*p4.x+t52.e*p4.y+t52.f}}var{cos:cos3,sin:sin3,PI:PI3}=Math,{tan:tan3}=Math,import_deep_rename_keys=__toESM2(require_deep_rename_keys()),import_xml_reader=__toESM2(require_reader());var BaseSolver=class{constructor(){__publicField(this,"MAX_ITERATIONS",1e5);__publicField(this,"solved",!1);__publicField(this,"failed",!1);__publicField(this,"iterations",0);__publicField(this,"progress",0);__publicField(this,"error",null);__publicField(this,"activeSubSolver");__publicField(this,"failedSubSolvers");__publicField(this,"timeToSolve");__publicField(this,"stats",{});__publicField(this,"_setupDone",!1)}getSolverName(){return this.constructor.name}setup(){this._setupDone||(this._setup(),this._setupDone=!0)}_setup(){}step(){if(this._setupDone||this.setup(),!this.solved&&!this.failed){this.iterations++;try{this._step()}catch(e5){throw this.error=`${this.getSolverName()} error: ${e5}`,this.failed=!0,e5}!this.solved&&this.iterations>=this.MAX_ITERATIONS&&this.tryFinalAcceptance(),!this.solved&&this.iterations>=this.MAX_ITERATIONS&&(this.error=`${this.getSolverName()} ran out of iterations`,this.failed=!0),"computeProgress"in this&&(this.progress=this.computeProgress())}}_step(){}getConstructorParams(){throw new Error("getConstructorParams not implemented")}getOutput(){return null}solve(){let startTime=Date.now();for(;!this.solved&&!this.failed;)this.step();let endTime=Date.now();this.timeToSolve=endTime-startTime}visualize(){return{lines:[],points:[],rects:[],circles:[]}}tryFinalAcceptance(){}preview(){return{lines:[],points:[],rects:[],circles:[]}}};function clamp5(value,min,max){return Math.max(min,Math.min(max,value))}function computeMaxIterationsByNodeSizeAndConnectionCount(input2){let states=input2.planeSize*input2.layers,connectionCount=input2.connectionCount,connectionFactor=Math.sqrt(connectionCount),requestedMaxIterations=Math.max(1,input2.maxIterations),baseComputedMaxIterations=clamp5(Math.round(states*(8+1.2*connectionFactor)),15e4,12e6),computedMaxIters=clamp5(Math.round(baseComputedMaxIterations*input2.effort),15e4,12e6),minIterationBudgetIters=clamp5(Math.round(requestedMaxIterations*.2),15e4,2e6),maxIterationsIters=Math.max(1,Math.min(requestedMaxIterations,Math.max(minIterationBudgetIters,computedMaxIters))),baseSearchBudgetIters=clamp5(Math.round(states*(10+.8*connectionFactor)*input2.effort),5e4,4e6);return{maxIterationsIters,baseSearchBudgetIters}}function rippedContains(r5,id2){for(let cur=r5;cur;cur=cur.prev)if(cur.id===id2)return!0;return!1}var MinHeap=class{constructor(){__publicField(this,"f",[]);__publicField(this,"seq",[]);__publicField(this,"id",[]);__publicField(this,"n",0)}push(f3,seq,id2){let i3=this.n++;for(this.f[i3]=f3,this.seq[i3]=seq,this.id[i3]=id2;i3>0;){let p4=i3-1>>1;if(this.less(p4,i3))break;this.swap(i3,p4),i3=p4}}pop(){let out=this.id[0];return this.n--,this.n>0&&(this.f[0]=this.f[this.n],this.seq[0]=this.seq[this.n],this.id[0]=this.id[this.n],this.siftDown(0)),out}get size(){return this.n}clear(){this.n=0}siftDown(i3){for(;;){let l4=i3*2+1,r5=l4+1;if(l4>=this.n)return;let m4=l4;if(r5<this.n&&!this.less(l4,r5)&&(m4=r5),this.less(i3,m4))return;this.swap(i3,m4),i3=m4}}less(i3,j4){let fi3=this.f[i3],fj=this.f[j4];return fi3!==fj?fi3<fj:this.seq[i3]<this.seq[j4]}swap(i3,j4){let tmpF=this.f[i3];this.f[i3]=this.f[j4],this.f[j4]=tmpF;let tmpS=this.seq[i3];this.seq[i3]=this.seq[j4],this.seq[j4]=tmpS;let tmpI=this.id[i3];this.id[i3]=this.id[j4],this.id[j4]=tmpI}};function toRootNetName(connectionName,rootConnectionName){return rootConnectionName??connectionName.replace(/_mst\d+$/,"")}var DIRS_DR=[-1,-1,-1,0,0,1,1,1],DIRS_DC=[-1,0,1,-1,1,-1,0,1],HighDensitySolverA01=class extends BaseSolver{constructor(props){super();__publicField(this,"nodeWithPortPoints");__publicField(this,"cellSizeMm");__publicField(this,"viaDiameter");__publicField(this,"MAX_RIPS");__publicField(this,"maxCellCount");__publicField(this,"traceThickness");__publicField(this,"traceMargin");__publicField(this,"viaMinDistFromBorder");__publicField(this,"showPenaltyMap");__publicField(this,"showUsedCellMap");__publicField(this,"effort");__publicField(this,"stepMultiplier");__publicField(this,"hyperParameters");__publicField(this,"initialPenaltyFn");__publicField(this,"rows");__publicField(this,"cols");__publicField(this,"layers");__publicField(this,"gridOrigin");__publicField(this,"gridToBoundsTransform");__publicField(this,"availableZ");__publicField(this,"zToLayer");__publicField(this,"layerToZ");__publicField(this,"connNameToId");__publicField(this,"connIdToName");__publicField(this,"connIdToRootNet");__publicField(this,"overlapFriendlyRootNets");__publicField(this,"planeSize");__publicField(this,"usedCellsFlat");__publicField(this,"portOwnerFlat");__publicField(this,"usedDiagFlat");__publicField(this,"penalty2d");__publicField(this,"visitedStamp");__publicField(this,"sharedCrossRootPortCells");__publicField(this,"stamp",0);__publicField(this,"viaOffsetsDr");__publicField(this,"viaOffsetsDc");__publicField(this,"viaOffsetsLen");__publicField(this,"minViaRow");__publicField(this,"maxViaRow");__publicField(this,"minViaCol");__publicField(this,"maxViaCol");__publicField(this,"usedIndicesByConn");__publicField(this,"usedDiagIndicesByConn");__publicField(this,"unsolvedSegs");__publicField(this,"solvedRoutes");__publicField(this,"activeConnSeg",null);__publicField(this,"activeConnId",-1);__publicField(this,"crossLayerSearch",!1);__publicField(this,"nodePool");__publicField(this,"heap");__publicField(this,"seqCounter",0);__publicField(this,"_viaOccs",[]);__publicField(this,"ripCount");__publicField(this,"totalRipEvents",0);__publicField(this,"searchIterations",0);__publicField(this,"consecutiveSkips",0);__publicField(this,"penaltyCap");__publicField(this,"baseSearchBudgetIters");__publicField(this,"_moveCost",0);__publicField(this,"_moveRipped",null);this.nodeWithPortPoints=props.nodeWithPortPoints,this.cellSizeMm=props.cellSizeMm,this.viaDiameter=props.viaDiameter,this.maxCellCount=props.maxCellCount,this.traceThickness=props.traceThickness??.1,this.traceMargin=props.traceMargin??.15,this.viaMinDistFromBorder=props.viaMinDistFromBorder??.15,this.showPenaltyMap=props.showPenaltyMap??!1,this.showUsedCellMap=props.showUsedCellMap??!1,this.effort=props.effort??1,this.stepMultiplier=Math.max(1,Math.floor(props.stepMultiplier??1)),this.hyperParameters={shuffleSeed:0,ripCost:10,ripTracePenalty:.5,ripViaPenalty:.75,viaBaseCost:.1,greedyMultiplier:1.5,...props.hyperParameters},this.MAX_ITERATIONS=1e8,this.MAX_RIPS=200,this.initialPenaltyFn=props.initialPenaltyFn}get unsolvedConnections(){return this.unsolvedSegs}get solvedConnectionsMap(){return this.solvedRoutes}get activeConnection(){if(!this.activeConnSeg)return null;let s3=this.activeConnSeg;return{connectionName:this.connIdToName[s3.connId]??"",start:{row:s3.startRow,col:s3.startCol,z:s3.startZ,x:0,y:0},end:{row:s3.endRow,col:s3.endCol,z:s3.endZ,x:0,y:0}}}get openSet(){return{length:this.heap?.size??0}}get gridStats(){return{cells:this.planeSize||0,layers:this.layers||0,states:(this.planeSize||0)*(this.layers||0)}}getConstructorParams(){return[{nodeWithPortPoints:this.nodeWithPortPoints,cellSizeMm:this.cellSizeMm,viaDiameter:this.viaDiameter,maxCellCount:this.maxCellCount,stepMultiplier:this.stepMultiplier,traceThickness:this.traceThickness,traceMargin:this.traceMargin,viaMinDistFromBorder:this.viaMinDistFromBorder,showPenaltyMap:this.showPenaltyMap,showUsedCellMap:this.showUsedCellMap,effort:this.effort,hyperParameters:this.hyperParameters,initialPenaltyFn:this.initialPenaltyFn}]}_setup(){let{nodeWithPortPoints,cellSizeMm}=this,{width,height,center:center2}=nodeWithPortPoints;this.availableZ=nodeWithPortPoints.availableZ??[...new Set(nodeWithPortPoints.portPoints.map(pp3=>pp3.z))].sort((a3,b3)=>a3-b3),this.rows=Math.floor(height/cellSizeMm),this.cols=Math.floor(width/cellSizeMm),this.layers=this.availableZ.length,this.planeSize=this.rows*this.cols;let totalCells=this.layers*this.planeSize;if(this.maxCellCount!==void 0&&totalCells>this.maxCellCount){this.error=`Cell count ${totalCells} exceeds maxCellCount ${this.maxCellCount}`,this.failed=!0;return}let totalDiags=this.layers*Math.max(0,this.rows-1)*Math.max(0,this.cols-1)*2;this.zToLayer=new Map,this.layerToZ=new Map;for(let i3=0;i3<this.availableZ.length;i3++){let z4=this.availableZ[i3];this.zToLayer.set(z4,i3),this.layerToZ.set(i3,z4)}if(this.gridOrigin={x:center2.x-width/2,y:center2.y-height/2},this.gridToBoundsTransform=computeGridToAffineTransform({originX:this.gridOrigin.x,originY:this.gridOrigin.y,rows:this.rows,cols:this.cols,cellSizeMm,width,height}),this.connNameToId=new Map,this.connIdToName=[],this.connIdToRootNet=[],this.overlapFriendlyRootNets=new Set,this.penalty2d=new Float64Array(this.planeSize),this.initialPenaltyFn)for(let row=0;row<this.rows;row++){let rowBase=row*this.cols;for(let col=0;col<this.cols;col++){let x4=this.gridOrigin.x+(col+.5)*cellSizeMm,y4=this.gridOrigin.y+(row+.5)*cellSizeMm,px3=(col+.5)/this.cols,py3=(row+.5)/this.rows;this.penalty2d[rowBase+col]=this.initialPenaltyFn({x:x4,y:y4,px:px3,py:py3,row,col})}}this.usedCellsFlat=new Int32Array(totalCells).fill(-1),this.portOwnerFlat=new Int32Array(totalCells).fill(-1),this.usedDiagFlat=new Int32Array(totalDiags).fill(-1),this.visitedStamp=new Uint32Array(totalCells),this.stamp=0;let viaRadiusCells=Math.ceil(this.viaDiameter/2/cellSizeMm),r22=viaRadiusCells*viaRadiusCells,drList=[],dcList=[];for(let dr3=-viaRadiusCells;dr3<=viaRadiusCells;dr3++)for(let dc3=-viaRadiusCells;dc3<=viaRadiusCells;dc3++)dr3*dr3+dc3*dc3<=r22&&(drList.push(dr3),dcList.push(dc3));if(this.viaOffsetsLen=drList.length,this.viaOffsetsDr=new Int32Array(drList),this.viaOffsetsDc=new Int32Array(dcList),this.viaMinDistFromBorder>0){let borderCells=Math.ceil(this.viaMinDistFromBorder/cellSizeMm);this.minViaRow=borderCells,this.maxViaRow=this.rows-1-borderCells,this.minViaCol=borderCells,this.maxViaCol=this.cols-1-borderCells}else this.minViaRow=0,this.maxViaRow=this.rows-1,this.minViaCol=0,this.maxViaCol=this.cols-1;this.unsolvedSegs=this.buildConnectionSegs(),this.sharedCrossRootPortCells=new Set;let rootByPortFlat=new Map;for(let pp3 of this.nodeWithPortPoints.portPoints){let connId=this.connNameToId.get(pp3.connectionName);if(connId===void 0)continue;let cell=this.pointToCell(pp3),flatIdx=(cell.z*this.rows+cell.row)*this.cols+cell.col,rootNet=this.connIdToRootNet[connId],existingRoot=rootByPortFlat.get(flatIdx);existingRoot===void 0?rootByPortFlat.set(flatIdx,rootNet):existingRoot!==rootNet&&this.sharedCrossRootPortCells.add(flatIdx);let existing=this.portOwnerFlat[flatIdx];existing===-1||existing===connId?this.portOwnerFlat[flatIdx]=connId:this.portOwnerFlat[flatIdx]=-2}this.solvedRoutes=new Map,this.usedIndicesByConn=[],this.usedDiagIndicesByConn=[],this.ripCount=[],this.consecutiveSkips=0,this.penaltyCap=this.hyperParameters.ripCost*.5,this.shuffleConnections();let budget=computeMaxIterationsByNodeSizeAndConnectionCount({planeSize:this.planeSize,layers:this.layers,connectionCount:this.unsolvedSegs.length,effort:this.effort,maxIterations:this.MAX_ITERATIONS});this.baseSearchBudgetIters=budget.baseSearchBudgetIters,this.MAX_ITERATIONS=budget.maxIterationsIters,this.activeConnSeg=null,this.activeConnId=-1,this.nodePool=[],this.heap=new MinHeap,this.seqCounter=0}_step(){for(let i3=0;i3<this.stepMultiplier;i3++){if(this.solved||this.failed)return;this.stepOnce()}}stepOnce(){if(!this.activeConnSeg){if(this.unsolvedSegs.length===0){this.solved=!0;return}let next2=this.unsolvedSegs.shift();this.activeConnSeg=next2,this.activeConnId=next2.connId,this.crossLayerSearch=next2.startZ!==next2.endZ,this.nodePool=[],this.heap.clear(),this.seqCounter=0,this.searchIterations=0,this.nextStamp();let f3=this.computeH(next2.startZ,next2.startRow,next2.startCol,next2.endZ,next2.endRow,next2.endCol)*this.hyperParameters.greedyMultiplier;this.nodePool.push({z:next2.startZ,row:next2.startRow,col:next2.startCol,g:0,f:f3,parentIdx:-1,ripped:null}),this.heap.push(f3,this.seqCounter++,0);return}this.searchIterations++;let connRips=this.ripCount[this.activeConnId]??0,budget=Math.round(this.baseSearchBudgetIters*(1+Math.min(connRips,10)*.25));if(this.searchIterations>budget){let pen=this.penalty2d;for(let i3=0;i3<pen.length;i3++)pen[i3]=pen[i3]*.9;this.unsolvedSegs.push(this.activeConnSeg),this.activeConnSeg=null,this.activeConnId=-1,this.heap.clear(),this.nodePool=[],this.consecutiveSkips++,this.consecutiveSkips>=this.unsolvedSegs.length*3&&(this.error=`Convergence failure: ${this.unsolvedSegs.length} connections stuck`,this.failed=!0);return}if(this.heap.size===0){this.error=`No path found for ${this.connIdToName[this.activeConnId]}`,this.failed=!0;return}let nodeIdx=this.heap.pop(),node=this.nodePool[nodeIdx],{z:z4,row,col,g:g6,ripped}=node,cellIdx=(z4*this.rows+row)*this.cols+col;if(this.visitedStamp[cellIdx]===this.stamp)return;this.visitedStamp[cellIdx]=this.stamp;let seg=this.activeConnSeg;if(z4===seg.endZ&&row===seg.endRow&&col===seg.endCol){this.finalizeRoute(nodeIdx),this.activeConnSeg=null,this.activeConnId=-1;return}let endZ=seg.endZ,endRow=seg.endRow,endCol=seg.endCol,activeConn=this.activeConnId,rows=this.rows,cols=this.cols,cellSizeMm=this.cellSizeMm,visited=this.visitedStamp,stamp=this.stamp;for(let d4=0;d4<8;d4++){let nr3=row+DIRS_DR[d4],nc3=col+DIRS_DC[d4];if(nr3<0||nr3>=rows||nc3<0||nc3>=cols)continue;let nIdx=(z4*rows+nr3)*cols+nc3;if(visited[nIdx]===stamp||(this.computeMoveCostAndRips(activeConn,z4,row,col,z4,nr3,nc3,ripped),this._moveCost<0))continue;let g22=g6+this._moveCost,f22=g22+this.computeH(z4,nr3,nc3,endZ,endRow,endCol)*this.hyperParameters.greedyMultiplier,newNodeIdx=this.nodePool.length;this.nodePool.push({z:z4,row:nr3,col:nc3,g:g22,f:f22,parentIdx:nodeIdx,ripped:this._moveRipped}),this.heap.push(f22,this.seqCounter++,newNodeIdx)}if(row>=this.minViaRow&&row<=this.maxViaRow&&col>=this.minViaCol&&col<=this.maxViaCol)for(let nz2=0;nz2<this.layers;nz2++){if(nz2===z4)continue;let nIdx=(nz2*rows+row)*cols+col;if(visited[nIdx]===stamp||(this.computeMoveCostAndRips(activeConn,z4,row,col,nz2,row,col,ripped),this._moveCost<0))continue;let g22=g6+this._moveCost,f22=g22+this.computeH(nz2,row,col,endZ,endRow,endCol)*this.hyperParameters.greedyMultiplier,newNodeIdx=this.nodePool.length;this.nodePool.push({z:nz2,row,col,g:g22,f:f22,parentIdx:nodeIdx,ripped:this._moveRipped}),this.heap.push(f22,this.seqCounter++,newNodeIdx)}}computeMoveCostAndRips(activeConn,fromZ,fromRow,fromCol,toZ,toRow,toCol,ripped){let cost=0,r5=ripped,cols=this.cols;if(fromZ!==toZ){cost+=this.hyperParameters.viaBaseCost,cost+=Math.min(this.penalty2d[toRow*cols+toCol],this.penaltyCap);let toFlatIdx=(toZ*this.rows+toRow)*cols+toCol,fixedOwner=this.portOwnerFlat[toFlatIdx],allowFixedOverlap=this.connIdToRootNet[fixedOwner]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]),seg=this.activeConnSeg,isSegEnd=!!seg&&toZ===seg.endZ&&toRow===seg.endRow&&toCol===seg.endCol;if(fixedOwner>=0&&fixedOwner!==activeConn&&!allowFixedOverlap&&!isSegEnd){this._moveCost=-1,this._moveRipped=r5;return}this.fillViaOccupants(toRow,toCol,activeConn);let occs=this._viaOccs;for(let i3=0;i3<occs.length;i3++){let occ=occs[i3];rippedContains(r5,occ)||(cost+=this.hyperParameters.ripCost,r5={id:occ,prev:r5}),cost+=this.hyperParameters.ripViaPenalty}}else{let dr3=fromRow>toRow?fromRow-toRow:toRow-fromRow,dc3=fromCol>toCol?fromCol-toCol:toCol-fromCol;cost+=(dr3+dc3>1?Math.SQRT2:1)*this.cellSizeMm,cost+=Math.min(this.penalty2d[toRow*cols+toCol],this.penaltyCap);let flatIdx=(toZ*this.rows+toRow)*cols+toCol,fixedOwner=this.portOwnerFlat[flatIdx],allowFixedOverlap=this.connIdToRootNet[fixedOwner]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]),seg=this.activeConnSeg,isSegEnd=!!seg&&toZ===seg.endZ&&toRow===seg.endRow&&toCol===seg.endCol;if(fixedOwner>=0&&fixedOwner!==activeConn&&!allowFixedOverlap&&!isSegEnd){this._moveCost=-1,this._moveRipped=r5;return}let occ=this.usedCellsFlat[flatIdx],allowSameRootOverlap=this.connIdToRootNet[occ]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]);if(occ!==-1&&occ!==activeConn&&!allowSameRootOverlap&&(rippedContains(r5,occ)||(cost+=this.hyperParameters.ripCost,r5={id:occ,prev:r5}),cost+=this.hyperParameters.ripTracePenalty),dr3===1&&dc3===1){let sqRow=fromRow<toRow?fromRow:toRow,sqCol=fromCol<toCol?fromCol:toCol,crossingSlot=(fromRow<toRow&&fromCol<toCol||fromRow>toRow&&fromCol>toCol?0:1)^1,sqCols=this.cols-1,diagBase=((toZ*(this.rows-1)+sqRow)*sqCols+sqCol)*2,crossingOcc=this.usedDiagFlat[diagBase+crossingSlot],allowCrossingOverlap=this.connIdToRootNet[crossingOcc]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]);if(crossingOcc!==-1&&crossingOcc!==activeConn&&!allowCrossingOverlap){this._moveCost=-1,this._moveRipped=r5;return}}}this._moveCost=cost,this._moveRipped=r5}fillViaOccupants(row,col,activeConn){let occs=this._viaOccs;occs.length=0;let rows=this.rows,cols=this.cols,offDr=this.viaOffsetsDr,offDc=this.viaOffsetsDc,offLen=this.viaOffsetsLen,used=this.usedCellsFlat;for(let z4=0;z4<this.layers;z4++){let zBase=z4*this.planeSize;for(let i3=0;i3<offLen;i3++){let r5=row+offDr[i3],c4=col+offDc[i3];if(r5<0||c4<0||r5>=rows||c4>=cols)continue;let occ=used[zBase+r5*cols+c4];if(occ===-1||occ===activeConn||this.connIdToRootNet[occ]===this.connIdToRootNet[activeConn]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[activeConn]))continue;let seen=!1;for(let j4=0;j4<occs.length;j4++)if(occs[j4]===occ){seen=!0;break}seen||occs.push(occ)}}}shouldSkipFixedPortHalo(flatIdx,connId){let fixedOwner=this.portOwnerFlat[flatIdx];return fixedOwner===connId?!1:fixedOwner===-2?!0:fixedOwner<0?!1:!(this.connIdToRootNet[fixedOwner]===this.connIdToRootNet[connId]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[connId]))}nextStamp(){this.stamp=this.stamp+1>>>0,this.stamp===0&&(this.visitedStamp.fill(0),this.stamp=1)}computeH(z4,row,col,toZ,toRow,toCol){let dr3=Math.abs(row-toRow),dc3=Math.abs(col-toCol),manhattan=dr3+dc3;if(z4===toZ)return manhattan*this.cellSizeMm;if(!this.crossLayerSearch)return manhattan*this.cellSizeMm+this.hyperParameters.viaBaseCost;let vr1=Math.max(this.minViaRow,Math.min(this.maxViaRow,row)),vc1=Math.max(this.minViaCol,Math.min(this.maxViaCol,col)),vr22=Math.max(this.minViaRow,Math.min(this.maxViaRow,toRow)),vc22=Math.max(this.minViaCol,Math.min(this.maxViaCol,toCol)),via1=Math.abs(row-vr1)+Math.abs(col-vc1)+Math.abs(vr1-toRow)+Math.abs(vc1-toCol),via2=Math.abs(row-vr22)+Math.abs(col-vc22)+Math.abs(vr22-toRow)+Math.abs(vc22-toCol);return Math.max(Math.min(via1,via2),manhattan)*this.cellSizeMm+this.hyperParameters.viaBaseCost}internConn(name,rootNetName){let existing=this.connNameToId.get(name);if(existing!==void 0)return existing;let id2=this.connIdToName.length;return this.connIdToName.push(name),this.connIdToRootNet.push(toRootNetName(name,rootNetName)),this.connNameToId.set(name,id2),id2}buildConnectionSegs(){let byName=new Map;for(let pp3 of this.nodeWithPortPoints.portPoints){let name=pp3.connectionName;byName.has(name)||byName.set(name,{points:[],rootConnectionName:pp3.rootConnectionName}),byName.get(name).points.push(pp3)}let segs=[],seenSegmentKeys=new Set;for(let[name,conn]of byName){let pts=conn.points;if(pts.length<2)continue;let connId=this.internConn(name,conn.rootConnectionName);for(let i3=0;i3<pts.length-1;i3++){let s3=this.pointToCell(pts[i3]),e5=this.pointToCell(pts[i3+1]),endpointA=`${s3.z}:${s3.row}:${s3.col}`,endpointB=`${e5.z}:${e5.row}:${e5.col}`,orderedEndpoints=endpointA<endpointB?`${endpointA}|${endpointB}`:`${endpointB}|${endpointA}`,netName=conn.rootConnectionName??name,segKey=`${netName}|${orderedEndpoints}`;if(seenSegmentKeys.has(segKey)){this.overlapFriendlyRootNets.add(netName);continue}seenSegmentKeys.add(segKey),segs.push({connId,startZ:s3.z,startRow:s3.row,startCol:s3.col,startPoint:pts[i3],endZ:e5.z,endRow:e5.row,endCol:e5.col,endPoint:pts[i3+1]})}}return segs}pointToCell(pt3){let col=Math.max(0,Math.min(this.cols-1,Math.round((pt3.x-this.gridOrigin.x)/this.cellSizeMm-.5))),row=Math.max(0,Math.min(this.rows-1,Math.round((pt3.y-this.gridOrigin.y)/this.cellSizeMm-.5)));return{z:this.zToLayer.get(pt3.z)??0,row,col}}shuffleConnections(){let arr=this.unsolvedSegs,s3=this.hyperParameters.shuffleSeed,rng=()=>(s3=s3*1664525+1013904223&4294967295,(s3>>>0)/4294967295);for(let i3=arr.length-1;i3>0;i3--){let j4=Math.floor(rng()*(i3+1)),tmp=arr[i3];arr[i3]=arr[j4],arr[j4]=tmp}}finalizeRoute(goalNodeIdx){this.consecutiveSkips=Math.max(0,this.consecutiveSkips-1);let cells=[],idx=goalNodeIdx;for(;idx>=0;){let n4=this.nodePool[idx];cells.push({z:n4.z,row:n4.row,col:n4.col}),idx=n4.parentIdx}for(cells.reverse();cells.length>1;){let first=cells[0],firstFlat=(first.z*this.rows+first.row)*this.cols+first.col;if(!this.sharedCrossRootPortCells.has(firstFlat))break;cells.shift()}for(;cells.length>1;){let last=cells[cells.length-1],lastFlat=(last.z*this.rows+last.row)*this.cols+last.col;if(!this.sharedCrossRootPortCells.has(lastFlat))break;cells.pop()}let viaCells=[];for(let i3=1;i3<cells.length;i3++)cells[i3].z!==cells[i3-1].z&&viaCells.push({row:cells[i3].row,col:cells[i3].col});let firstCell=cells[0],lastCell=cells[cells.length-1],connId=this.activeConnId,goalNode=this.nodePool[goalNodeIdx],rippedIds=[];for(let cur=goalNode.ripped;cur;cur=cur.prev)rippedIds.push(cur.id);for(let i3=0;i3<rippedIds.length;i3++)if(this.ripTrace(rippedIds[i3]),this.failed)return;let marginCells=Math.ceil(this.traceMargin/this.cellSizeMm),indices=[],rows=this.rows,cols=this.cols,used=this.usedCellsFlat;for(let ci3=0;ci3<cells.length;ci3++){let cell=cells[ci3];for(let dr3=-marginCells;dr3<=marginCells;dr3++)for(let dc3=-marginCells;dc3<=marginCells;dc3++){let r5=cell.row+dr3,c4=cell.col+dc3;if(r5<0||r5>=rows||c4<0||c4>=cols)continue;let flatIdx=(cell.z*rows+r5)*cols+c4;if((r5!==cell.row||c4!==cell.col)&&this.shouldSkipFixedPortHalo(flatIdx,connId))continue;let existing=used[flatIdx],allowSameRootOverlap=this.connIdToRootNet[existing]===this.connIdToRootNet[connId]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[connId]);existing!==-1&&existing!==connId&&!allowSameRootOverlap||(used[flatIdx]=connId,indices.push(flatIdx))}}let displacedByVias=[],offDr=this.viaOffsetsDr,offDc=this.viaOffsetsDc,offLen=this.viaOffsetsLen;for(let vi3=0;vi3<viaCells.length;vi3++){let via=viaCells[vi3];for(let z4=0;z4<this.layers;z4++){let zBase=z4*this.planeSize;for(let oi3=0;oi3<offLen;oi3++){let r5=via.row+offDr[oi3],c4=via.col+offDc[oi3];if(r5<0||r5>=rows||c4<0||c4>=cols)continue;let flatIdx=zBase+r5*cols+c4;if((r5!==via.row||c4!==via.col)&&this.shouldSkipFixedPortHalo(flatIdx,connId))continue;let existing=used[flatIdx],allowSameRootOverlap=this.connIdToRootNet[existing]===this.connIdToRootNet[connId]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[connId]);if(existing!==-1&&existing!==connId&&!allowSameRootOverlap){let seen=!1;for(let k4=0;k4<displacedByVias.length;k4++)if(displacedByVias[k4]===existing){seen=!0;break}seen||displacedByVias.push(existing)}used[flatIdx]=connId,indices.push(flatIdx)}}}let diagIndices=[],sqCols=this.cols-1;for(let i3=1;i3<cells.length;i3++){let prev=cells[i3-1],curr=cells[i3];if(prev.z!==curr.z)continue;let dr3=prev.row>curr.row?prev.row-curr.row:curr.row-prev.row,dc3=prev.col>curr.col?prev.col-curr.col:curr.col-prev.col;if(dr3!==1||dc3!==1)continue;let sqRow=prev.row<curr.row?prev.row:curr.row,sqCol=prev.col<curr.col?prev.col:curr.col,diagSlot=prev.row<curr.row&&prev.col<curr.col||prev.row>curr.row&&prev.col>curr.col?0:1,crossingSlot=diagSlot^1,diagBase=((prev.z*(this.rows-1)+sqRow)*sqCols+sqCol)*2,crossingIdx=diagBase+crossingSlot,crossingOcc=this.usedDiagFlat[crossingIdx],allowCrossingOverlap=this.connIdToRootNet[crossingOcc]===this.connIdToRootNet[connId]&&this.overlapFriendlyRootNets.has(this.connIdToRootNet[connId]);if(crossingOcc!==-1&&crossingOcc!==connId&&!allowCrossingOverlap)continue;let diagIdx=diagBase+diagSlot;this.usedDiagFlat[diagIdx]=connId,diagIndices.push(diagIdx)}for(;this.usedIndicesByConn.length<=connId;)this.usedIndicesByConn.push([]);let usedIndices=this.usedIndicesByConn[connId]??[];for(usedIndices.push(...indices),this.usedIndicesByConn[connId]=usedIndices;this.usedDiagIndicesByConn.length<=connId;)this.usedDiagIndicesByConn.push([]);let usedDiagIndices=this.usedDiagIndicesByConn[connId]??[];usedDiagIndices.push(...diagIndices),this.usedDiagIndicesByConn[connId]=usedDiagIndices;let solvedRoutes=this.solvedRoutes.get(connId)??[];solvedRoutes.push({connId,startZ:firstCell.z,startRow:firstCell.row,startCol:firstCell.col,startPoint:this.activeConnSeg.startPoint,endZ:lastCell.z,endRow:lastCell.row,endCol:lastCell.col,endPoint:this.activeConnSeg.endPoint,cells,viaCells}),this.solvedRoutes.set(connId,solvedRoutes);for(let i3=0;i3<displacedByVias.length;i3++)if(this.ripTrace(displacedByVias[i3]),this.failed)return;if(rippedIds.length>0||displacedByVias.length>0){let pen=this.penalty2d,cap2=this.penaltyCap;if(this.totalRipEvents>50)for(let i3=0;i3<pen.length;i3++)pen[i3]=pen[i3]*.99;else for(let i3=0;i3<pen.length;i3++)pen[i3]>cap2&&(pen[i3]=pen[i3]*.5)}}ripTrace(connId){for(;this.ripCount.length<=connId;)this.ripCount.push(0);if(this.ripCount[connId]++,this.totalRipEvents++,this.totalRipEvents>=this.MAX_RIPS){this.error=`Convergence failure: exceeded MAX_RIPS ${this.MAX_RIPS}`,this.failed=!0;return}let routes=this.solvedRoutes.get(connId)??[];if(routes.length>0){let cols=this.cols;for(let route of routes){for(let i3=0;i3<route.cells.length;i3++){let cell=route.cells[i3],cellIdx=cell.row*cols+cell.col;this.penalty2d[cellIdx]=this.penalty2d[cellIdx]+this.hyperParameters.ripTracePenalty}for(let i3=0;i3<route.viaCells.length;i3++){let via=route.viaCells[i3],viaIdx=via.row*cols+via.col;this.penalty2d[viaIdx]=this.penalty2d[viaIdx]+this.hyperParameters.ripViaPenalty}}}let indices=this.usedIndicesByConn[connId];if(indices){let used=this.usedCellsFlat;for(let i3=0;i3<indices.length;i3++){let flatIdx=indices[i3];used[flatIdx]===connId&&(used[flatIdx]=-1)}this.usedIndicesByConn[connId]=[]}let diagIndices=this.usedDiagIndicesByConn[connId];if(diagIndices){let usedDiag=this.usedDiagFlat;for(let i3=0;i3<diagIndices.length;i3++){let flatIdx=diagIndices[i3];usedDiag[flatIdx]===connId&&(usedDiag[flatIdx]=-1)}this.usedDiagIndicesByConn[connId]=[]}if(routes.length>0){this.solvedRoutes.delete(connId);for(let route of routes)this.unsolvedSegs.push({connId,startZ:route.startZ,startRow:route.startRow,startCol:route.startCol,startPoint:route.startPoint,endZ:route.endZ,endRow:route.endRow,endCol:route.endCol,endPoint:route.endPoint})}}visualize(){let LAYER_COLORS2=["red","blue","orange","green"],points=[],lines=[],circles=[],rects=[],{width,height,center:center2}=this.nodeWithPortPoints;rects.push({center:{x:center2.x,y:center2.y},width,height,stroke:"gray"});let vt3=this.gridToBoundsTransform;if(this.showPenaltyMap&&this.penalty2d){let maxPenalty=0;for(let i3=0;i3<this.penalty2d.length;i3++)this.penalty2d[i3]>maxPenalty&&(maxPenalty=this.penalty2d[i3]);if(maxPenalty>0)for(let row=0;row<this.rows;row++)for(let col=0;col<this.cols;col++){let p4=this.penalty2d[row*this.cols+col];if(p4<=0)continue;let alpha=Math.min(.6,p4/maxPenalty*.6),tc3=applyAffineTransformToPoint(vt3,{x:this.gridOrigin.x+(col+.5)*this.cellSizeMm,y:this.gridOrigin.y+(row+.5)*this.cellSizeMm});rects.push({center:tc3,width:this.cellSizeMm*vt3.a,height:this.cellSizeMm*vt3.e,fill:`rgba(255,165,0,${alpha.toFixed(3)})`})}}if(this.showUsedCellMap&&this.usedCellsFlat)for(let z4=0;z4<this.layers;z4++)for(let row=0;row<this.rows;row++)for(let col=0;col<this.cols;col++){if(this.usedCellsFlat[(z4*this.rows+row)*this.cols+col]===-1)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.gridOrigin.x+(col+.5)*this.cellSizeMm,y:this.gridOrigin.y+(row+.5)*this.cellSizeMm});rects.push({center:tc3,width:this.cellSizeMm*vt3.a,height:this.cellSizeMm*vt3.e,fill:"rgba(0,0,255,0.5)"})}for(let pp3 of this.nodeWithPortPoints.portPoints)points.push({x:pp3.x,y:pp3.y,color:LAYER_COLORS2[pp3.z]??"gray",label:pp3.connectionName});let TRACE_COLORS3=["rgba(255,0,0,0.75)","rgba(0,0,255,0.75)","rgba(255,165,0,0.75)","rgba(0,128,0,0.75)"],transformedRoutes=this.getOutput();for(let route of transformedRoutes){if(route.route.length<2)continue;let segStart=0;for(let i3=1;i3<route.route.length;i3++){let prev=route.route[i3-1];route.route[i3].z!==prev.z&&(i3-segStart>=2&&lines.push({points:route.route.slice(segStart,i3).map(p4=>({x:p4.x,y:p4.y})),strokeColor:TRACE_COLORS3[prev.z]??"rgba(128,128,128,0.75)",strokeWidth:this.traceThickness}),segStart=i3)}if(route.route.length-segStart>=2){let lastZ=route.route[segStart].z;lines.push({points:route.route.slice(segStart).map(p4=>({x:p4.x,y:p4.y})),strokeColor:TRACE_COLORS3[lastZ]??"rgba(128,128,128,0.75)",strokeWidth:this.traceThickness})}}for(let route of transformedRoutes)for(let via of route.vias)circles.push({center:{x:via.x,y:via.y},radius:this.viaDiameter/2,fill:"rgba(0,0,0,0.3)",stroke:"black"});if(this.activeConnSeg&&this.visitedStamp){let currentStamp=this.stamp;for(let z4=0;z4<this.layers;z4++)for(let row=0;row<this.rows;row++)for(let col=0;col<this.cols;col++){if(this.visitedStamp[(z4*this.rows+row)*this.cols+col]!==currentStamp)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.gridOrigin.x+(col+.5)*this.cellSizeMm,y:this.gridOrigin.y+(row+.5)*this.cellSizeMm});points.push({x:tc3.x,y:tc3.y,color:"rgba(0,0,255,0.2)"})}}return{points,lines,circles,rects,coordinateSystem:"cartesian",title:`HighDensityA01 [${this.solvedRoutes?.size??0} solved, ${this.unsolvedSegs?.length??0} remaining]`}}getOutput(){let t52=this.gridToBoundsTransform,result=[];for(let[connId,routes]of this.solvedRoutes??[]){let connName=this.connIdToName[connId];for(let route of routes){let points=route.cells.map(cell=>{let rawX=this.gridOrigin.x+(cell.col+.5)*this.cellSizeMm,rawY=this.gridOrigin.y+(cell.row+.5)*this.cellSizeMm,tp3=applyAffineTransformToPoint(t52,{x:rawX,y:rawY});return{x:tp3.x,y:tp3.y,z:this.layerToZ.get(cell.z)??cell.z}});points.length>0&&(points[0]={...route.startPoint},points.length>1&&(points[points.length-1]={...route.endPoint})),result.push({connectionName:connName,rootConnectionName:this.connIdToRootNet[connId],traceThickness:this.traceThickness,viaDiameter:this.viaDiameter,route:points,vias:route.viaCells.map(via=>{let rawX=this.gridOrigin.x+(via.col+.5)*this.cellSizeMm,rawY=this.gridOrigin.y+(via.row+.5)*this.cellSizeMm;return applyAffineTransformToPoint(t52,{x:rawX,y:rawY})})})}}return result}};var REGION_LEFT=0,REGION_TOP=1,REGION_RIGHT=2,REGION_BOTTOM=3,REGION_MIDDLE=4,REGION_NAMES=["left","top","right","bottom","middle"],TypedMinHeap2=class{constructor(){__publicField(this,"f",new Float64Array(1024));__publicField(this,"seq",new Uint32Array(1024));__publicField(this,"id",new Int32Array(1024));__publicField(this,"n",0)}push(f3,seq,id2){this.ensureCapacity(this.n+1);let i3=this.n++;for(this.f[i3]=f3,this.seq[i3]=seq,this.id[i3]=id2;i3>0;){let p4=i3-1>>1;if(this.less(p4,i3))break;this.swap(i3,p4),i3=p4}}pop(){let out=this.id[0];return this.n--,this.n>0&&(this.f[0]=this.f[this.n],this.seq[0]=this.seq[this.n],this.id[0]=this.id[this.n],this.siftDown(0)),out}get size(){return this.n}clear(){this.n=0}ensureCapacity(size3){if(size3<=this.f.length)return;let next2=this.f.length;for(;next2<size3;)next2*=2;let nf3=new Float64Array(next2);nf3.set(this.f),this.f=nf3;let ns3=new Uint32Array(next2);ns3.set(this.seq),this.seq=ns3;let ni3=new Int32Array(next2);ni3.set(this.id),this.id=ni3}siftDown(i3){for(;;){let l4=i3*2+1,r5=l4+1;if(l4>=this.n)return;let m4=l4;if(r5<this.n&&!this.less(l4,r5)&&(m4=r5),this.less(i3,m4))return;this.swap(i3,m4),i3=m4}}less(i3,j4){let fi3=this.f[i3],fj=this.f[j4];return fi3!==fj?fi3<fj:this.seq[i3]<this.seq[j4]}swap(i3,j4){let tf3=this.f[i3];this.f[i3]=this.f[j4],this.f[j4]=tf3;let ts3=this.seq[i3];this.seq[i3]=this.seq[j4],this.seq[j4]=ts3;let ti3=this.id[i3];this.id[i3]=this.id[j4],this.id[j4]=ti3}},TypedNodePool2=class{constructor(){__publicField(this,"z",new Int32Array(1024));__publicField(this,"cellId",new Int32Array(1024));__publicField(this,"g",new Float64Array(1024));__publicField(this,"parent",new Int32Array(1024));__publicField(this,"ripHead",new Int32Array(1024).fill(-1));__publicField(this,"ripCount",new Int32Array(1024));__publicField(this,"length",0)}clear(){this.length=0}push(z4,cellId,g6,parent,ripHead,ripCount){this.ensureCapacity(this.length+1);let idx=this.length++;return this.z[idx]=z4,this.cellId[idx]=cellId,this.g[idx]=g6,this.parent[idx]=parent,this.ripHead[idx]=ripHead,this.ripCount[idx]=ripCount,idx}ensureCapacity(size3){if(size3<=this.z.length)return;let next2=this.z.length;for(;next2<size3;)next2*=2;let nz2=new Int32Array(next2);nz2.set(this.z),this.z=nz2;let nc3=new Int32Array(next2);nc3.set(this.cellId),this.cellId=nc3;let ng3=new Float64Array(next2);ng3.set(this.g),this.g=ng3;let np2=new Int32Array(next2);np2.set(this.parent),this.parent=np2;let nr3=new Int32Array(next2);nr3.fill(-1),nr3.set(this.ripHead.subarray(0,this.length)),this.ripHead=nr3;let nrc=new Int32Array(next2);nrc.set(this.ripCount.subarray(0,this.length)),this.ripCount=nrc}},TypedRipChain2=class{constructor(){__publicField(this,"connId",new Int32Array(1024));__publicField(this,"prev",new Int32Array(1024).fill(-1));__publicField(this,"length",0)}clear(){this.length=0}append(prevHead,connId){this.ensureCapacity(this.length+1);let idx=this.length++;return this.connId[idx]=connId,this.prev[idx]=prevHead,idx}contains(head,connId){for(let cur=head;cur>=0;cur=this.prev[cur])if(this.connId[cur]===connId)return!0;return!1}collect(head,out){out.length=0;for(let cur=head;cur>=0;cur=this.prev[cur])out.push(this.connId[cur])}ensureCapacity(size3){if(size3<=this.connId.length)return;let next2=this.connId.length;for(;next2<size3;)next2*=2;let nc3=new Int32Array(next2);nc3.set(this.connId),this.connId=nc3;let np2=new Int32Array(next2);np2.fill(-1),np2.set(this.prev.subarray(0,this.length)),this.prev=np2}};function toRootNetName3(connectionName,rootConnectionName){return rootConnectionName??connectionName.replace(/_mst\d+$/,"")}function clamp32(value,min,max){return Math.max(min,Math.min(max,value))}function pushUnique2(arr,value){for(let i3=0;i3<arr.length;i3++)if(arr[i3]===value)return;arr.push(value)}function pushUniqueNeighbor2(arr,edge){for(let i3=0;i3<arr.length;i3++)if(arr[i3].cellId===edge.cellId)return;arr.push(edge)}function circleIntersectsRect2(cx3,cy3,r5,minX,minY,maxX,maxY){let qx3=clamp32(cx3,minX,maxX),qy3=clamp32(cy3,minY,maxY),dx3=cx3-qx3,dy3=cy3-qy3;return dx3*dx3+dy3*dy3<=r5*r5}var HighDensitySolverA03=class extends BaseSolver{constructor(props){super();__publicField(this,"nodeWithPortPoints");__publicField(this,"highResolutionCellSize");__publicField(this,"highResolutionCellThickness");__publicField(this,"lowResolutionCellSize");__publicField(this,"viaDiameter");__publicField(this,"MAX_RIPS");__publicField(this,"maxCellCount");__publicField(this,"traceThickness");__publicField(this,"traceMargin");__publicField(this,"viaMinDistFromBorder");__publicField(this,"showPenaltyMap");__publicField(this,"showUsedCellMap");__publicField(this,"effort");__publicField(this,"stepMultiplier");__publicField(this,"hyperParameters");__publicField(this,"initialPenaltyFn");__publicField(this,"boundsMinX");__publicField(this,"boundsMaxX");__publicField(this,"boundsMinY");__publicField(this,"boundsMaxY");__publicField(this,"gridToBoundsTransform");__publicField(this,"availableZ");__publicField(this,"zToLayer");__publicField(this,"layerToZ");__publicField(this,"layers");__publicField(this,"fineRows");__publicField(this,"fineCols");__publicField(this,"lowScale");__publicField(this,"bandRows");__publicField(this,"bandCols");__publicField(this,"regions");__publicField(this,"planeSize");__publicField(this,"cellCenterX");__publicField(this,"cellCenterY");__publicField(this,"cellMinX");__publicField(this,"cellMinY");__publicField(this,"cellMaxX");__publicField(this,"cellMaxY");__publicField(this,"cellWidth");__publicField(this,"cellHeight");__publicField(this,"cellRegion");__publicField(this,"cellRow");__publicField(this,"cellCol");__publicField(this,"viaAllowed");__publicField(this,"neighborOffset");__publicField(this,"neighborIds");__publicField(this,"neighborCosts");__publicField(this,"usedCellsFlat");__publicField(this,"sharedCellsFlat");__publicField(this,"portOwnerFlat");__publicField(this,"penalty2d");__publicField(this,"ripStateBuckets");__publicField(this,"visitedStamp");__publicField(this,"bestGStamp");__publicField(this,"bestGValue");__publicField(this,"visitedFlatStamp");__publicField(this,"sharedCrossRootPortFlat");__publicField(this,"stamp",0);__publicField(this,"connNameToId");__publicField(this,"connIdToName");__publicField(this,"connIdToRootNet");__publicField(this,"overlapFriendlyRootNets");__publicField(this,"usedIndicesByConn");__publicField(this,"unsolvedSegs");__publicField(this,"solvedRoutes");__publicField(this,"activeConnSeg",null);__publicField(this,"activeConnId",-1);__publicField(this,"nodePool");__publicField(this,"heap");__publicField(this,"ripChain");__publicField(this,"seqCounter",0);__publicField(this,"_viaOccs",[]);__publicField(this,"_cellOccs",[]);__publicField(this,"_rippedIds",[]);__publicField(this,"ripCount");__publicField(this,"totalRipEvents",0);__publicField(this,"searchIterations",0);__publicField(this,"consecutiveSkips",0);__publicField(this,"penaltyCap");__publicField(this,"baseSearchBudgetIters");__publicField(this,"_moveCost",0);__publicField(this,"_moveRippedHead",-1);__publicField(this,"_moveRipCount",0);__publicField(this,"traceKeepoutRadius");__publicField(this,"viaKeepoutRadius");this.nodeWithPortPoints=props.nodeWithPortPoints,this.highResolutionCellSize=props.highResolutionCellSize??.1,this.highResolutionCellThickness=Math.max(1,Math.floor(props.highResolutionCellThickness??8)),this.lowResolutionCellSize=props.lowResolutionCellSize??.4,this.viaDiameter=props.viaDiameter,this.maxCellCount=props.maxCellCount,this.traceThickness=props.traceThickness??.1,this.traceMargin=props.traceMargin??.15,this.viaMinDistFromBorder=props.viaMinDistFromBorder??.15,this.showPenaltyMap=props.showPenaltyMap??!1,this.showUsedCellMap=props.showUsedCellMap??!1,this.effort=props.effort??1,this.stepMultiplier=Math.max(1,Math.floor(props.stepMultiplier??1)),this.hyperParameters={shuffleSeed:0,ripCost:8,ripTracePenalty:.5,ripViaPenalty:.75,viaBaseCost:.1,greedyMultiplier:1.5,...props.hyperParameters},this.MAX_ITERATIONS=1e8,this.MAX_RIPS=200,this.initialPenaltyFn=props.initialPenaltyFn}get unsolvedConnections(){return this.unsolvedSegs}get solvedConnectionsMap(){let map=new Map;for(let connId=0;connId<this.solvedRoutes.length;connId++){let route=this.solvedRoutes[connId];route&&map.set(connId,route)}return map}get activeConnection(){if(!this.activeConnSeg)return null;let startCellId=this.activeConnSeg.startCellId,endCellId=this.activeConnSeg.endCellId;return{connectionName:this.connIdToName[this.activeConnSeg.connId]??"",start:{cellId:startCellId,region:REGION_NAMES[this.cellRegion[startCellId]],row:this.cellRow[startCellId],col:this.cellCol[startCellId],x:this.cellCenterX[startCellId],y:this.cellCenterY[startCellId],z:this.activeConnSeg.startZ},end:{cellId:endCellId,region:REGION_NAMES[this.cellRegion[endCellId]],row:this.cellRow[endCellId],col:this.cellCol[endCellId],x:this.cellCenterX[endCellId],y:this.cellCenterY[endCellId],z:this.activeConnSeg.endZ}}}get openSet(){return{length:this.heap?.size??0}}get gridStats(){return{cells:this.planeSize||0,layers:this.layers||0,states:(this.planeSize||0)*(this.layers||0),ripStateBuckets:this.ripStateBuckets||0,neighborEdges:this.neighborIds?.length??0,regionCounts:this.regions?Object.fromEntries(this.regions.map(region=>[region.name,region.rows*region.cols])):{}}}getConstructorParams(){return[{nodeWithPortPoints:this.nodeWithPortPoints,highResolutionCellSize:this.highResolutionCellSize,highResolutionCellThickness:this.highResolutionCellThickness,lowResolutionCellSize:this.lowResolutionCellSize,viaDiameter:this.viaDiameter,maxCellCount:this.maxCellCount,stepMultiplier:this.stepMultiplier,traceThickness:this.traceThickness,traceMargin:this.traceMargin,viaMinDistFromBorder:this.viaMinDistFromBorder,showPenaltyMap:this.showPenaltyMap,showUsedCellMap:this.showUsedCellMap,effort:this.effort,hyperParameters:this.hyperParameters,initialPenaltyFn:this.initialPenaltyFn}]}_setup(){let{nodeWithPortPoints}=this,{width,height,center:center2}=nodeWithPortPoints,rawScale=this.lowResolutionCellSize/this.highResolutionCellSize,roundedScale=Math.round(rawScale);if(!Number.isFinite(rawScale)||rawScale<=0||Math.abs(rawScale-roundedScale)>1e-9){this.error="lowResolutionCellSize must be a positive integer multiple of highResolutionCellSize",this.failed=!0;return}this.lowScale=Math.max(1,roundedScale),this.availableZ=nodeWithPortPoints.availableZ??[...new Set(nodeWithPortPoints.portPoints.map(pp3=>pp3.z))].sort((a3,b3)=>a3-b3),this.layers=this.availableZ.length,this.zToLayer=new Map,this.layerToZ=new Map;for(let i3=0;i3<this.availableZ.length;i3++){let z4=this.availableZ[i3];this.zToLayer.set(z4,i3),this.layerToZ.set(i3,z4)}this.boundsMinX=center2.x-width/2,this.boundsMaxX=center2.x+width/2,this.boundsMinY=center2.y-height/2,this.boundsMaxY=center2.y+height/2,this.traceKeepoutRadius=this.traceMargin+this.traceThickness/2,this.viaKeepoutRadius=this.viaDiameter/2+this.traceKeepoutRadius,this.buildFiveRegionGrid(width,height),this.gridToBoundsTransform=this.computeGridToBoundsTransform();let totalCells=this.layers*this.planeSize;if(this.maxCellCount!==void 0&&totalCells>this.maxCellCount){this.error=`Cell count ${totalCells} exceeds maxCellCount ${this.maxCellCount}`,this.failed=!0;return}this.connNameToId=new Map,this.connIdToName=[],this.connIdToRootNet=[],this.overlapFriendlyRootNets=new Set,this.unsolvedSegs=this.buildConnectionSegs(),this.penalty2d=new Float64Array(this.planeSize);let widthInv=width>0?1/width:0,heightInv=height>0?1/height:0;for(let cellId=0;cellId<this.planeSize;cellId++){let penalty=0;this.initialPenaltyFn&&(penalty+=this.initialPenaltyFn({x:this.cellCenterX[cellId],y:this.cellCenterY[cellId],px:(this.cellCenterX[cellId]-this.boundsMinX)*widthInv,py:(this.cellCenterY[cellId]-this.boundsMinY)*heightInv,cellId,region:REGION_NAMES[this.cellRegion[cellId]],row:this.cellRow[cellId],col:this.cellCol[cellId]})),this.penalty2d[cellId]=penalty}this.usedCellsFlat=new Int32Array(totalCells).fill(-1),this.sharedCellsFlat=Array.from({length:totalCells},()=>{}),this.portOwnerFlat=new Int32Array(totalCells).fill(-1),this.sharedCrossRootPortFlat=new Uint8Array(totalCells),this.ripStateBuckets=1;let searchStateCount=totalCells;this.visitedStamp=new Uint32Array(searchStateCount),this.bestGStamp=new Uint32Array(searchStateCount),this.bestGValue=new Float64Array(searchStateCount),this.visitedFlatStamp=new Uint32Array(totalCells),this.stamp=0;let rootByPortFlat=new Map;for(let pp3 of this.nodeWithPortPoints.portPoints){let connId=this.connNameToId.get(pp3.connectionName);if(connId===void 0)continue;let cell=this.pointToCell(pp3),flatIdx=cell.z*this.planeSize+cell.cellId,rootNet=this.connIdToRootNet[connId],existingRoot=rootByPortFlat.get(flatIdx);existingRoot===void 0?rootByPortFlat.set(flatIdx,rootNet):existingRoot!==rootNet&&(this.sharedCrossRootPortFlat[flatIdx]=1);let existing=this.portOwnerFlat[flatIdx];existing===-1||existing===connId?this.portOwnerFlat[flatIdx]=connId:this.portOwnerFlat[flatIdx]=-2}this.solvedRoutes=[],this.usedIndicesByConn=[],this.ripCount=[],this.consecutiveSkips=0,this.penaltyCap=this.hyperParameters.ripCost*.5,this.shuffleConnections();let budget=computeMaxIterationsByNodeSizeAndConnectionCount({planeSize:this.planeSize,layers:this.layers,connectionCount:this.unsolvedSegs.length,effort:this.effort,maxIterations:this.MAX_ITERATIONS});this.baseSearchBudgetIters=budget.baseSearchBudgetIters,this.MAX_ITERATIONS=budget.maxIterationsIters,this.activeConnSeg=null,this.activeConnId=-1,this.nodePool=new TypedNodePool2,this.heap=new TypedMinHeap2,this.ripChain=new TypedRipChain2,this.seqCounter=0}_step(){for(let i3=0;i3<this.stepMultiplier;i3++){if(this.solved||this.failed)return;this.stepOnce()}}buildFiveRegionGrid(width,height){this.fineCols=Math.max(1,Math.ceil(width/this.highResolutionCellSize)),this.fineRows=Math.max(1,Math.ceil(height/this.highResolutionCellSize)),this.bandCols=Math.min(this.highResolutionCellThickness,Math.floor(this.fineCols/2)),this.bandRows=Math.min(this.highResolutionCellThickness,Math.floor(this.fineRows/2));let middleFineCols=Math.max(0,this.fineCols-this.bandCols*2),middleFineRows=Math.max(0,this.fineRows-this.bandRows*2),topFineCols=middleFineCols,bottomFineCols=middleFineCols;this.regions=[{id:REGION_LEFT,name:"left",fineOriginRow:0,fineOriginCol:0,fineRows:this.fineRows,fineCols:this.bandCols,cellScale:1,rows:this.fineRows,cols:this.bandCols,offset:0},{id:REGION_TOP,name:"top",fineOriginRow:0,fineOriginCol:this.bandCols,fineRows:this.bandRows,fineCols:topFineCols,cellScale:1,rows:this.bandRows,cols:topFineCols,offset:0},{id:REGION_RIGHT,name:"right",fineOriginRow:0,fineOriginCol:this.fineCols-this.bandCols,fineRows:this.fineRows,fineCols:this.bandCols,cellScale:1,rows:this.fineRows,cols:this.bandCols,offset:0},{id:REGION_BOTTOM,name:"bottom",fineOriginRow:this.fineRows-this.bandRows,fineOriginCol:this.bandCols,fineRows:this.bandRows,fineCols:bottomFineCols,cellScale:1,rows:this.bandRows,cols:bottomFineCols,offset:0},{id:REGION_MIDDLE,name:"middle",fineOriginRow:this.bandRows,fineOriginCol:this.bandCols,fineRows:middleFineRows,fineCols:middleFineCols,cellScale:this.lowScale,rows:middleFineRows>0?Math.ceil(middleFineRows/this.lowScale):0,cols:middleFineCols>0?Math.ceil(middleFineCols/this.lowScale):0,offset:0}];let offset=0;for(let i3=0;i3<this.regions.length;i3++)this.regions[i3].offset=offset,offset+=this.regions[i3].rows*this.regions[i3].cols;this.planeSize=offset,this.cellCenterX=new Float64Array(this.planeSize),this.cellCenterY=new Float64Array(this.planeSize),this.cellMinX=new Float64Array(this.planeSize),this.cellMinY=new Float64Array(this.planeSize),this.cellMaxX=new Float64Array(this.planeSize),this.cellMaxY=new Float64Array(this.planeSize),this.cellWidth=new Float64Array(this.planeSize),this.cellHeight=new Float64Array(this.planeSize),this.cellRegion=new Uint8Array(this.planeSize),this.cellRow=new Int32Array(this.planeSize),this.cellCol=new Int32Array(this.planeSize),this.viaAllowed=new Uint8Array(this.planeSize);for(let regionIdx=0;regionIdx<this.regions.length;regionIdx++){let region=this.regions[regionIdx];for(let row=0;row<region.rows;row++){let fineRow0=region.fineOriginRow+row*region.cellScale,fineRow1=Math.min(region.fineOriginRow+region.fineRows,fineRow0+region.cellScale),minY=this.boundsMinY+fineRow0*this.highResolutionCellSize,maxY=Math.min(this.boundsMaxY,this.boundsMinY+fineRow1*this.highResolutionCellSize);for(let col=0;col<region.cols;col++){let fineCol0=region.fineOriginCol+col*region.cellScale,fineCol1=Math.min(region.fineOriginCol+region.fineCols,fineCol0+region.cellScale),minX=this.boundsMinX+fineCol0*this.highResolutionCellSize,maxX=Math.min(this.boundsMaxX,this.boundsMinX+fineCol1*this.highResolutionCellSize),cellId=this.cellIdFor(region.id,row,col);this.cellCenterX[cellId]=(minX+maxX)/2,this.cellCenterY[cellId]=(minY+maxY)/2,this.cellMinX[cellId]=minX,this.cellMinY[cellId]=minY,this.cellMaxX[cellId]=maxX,this.cellMaxY[cellId]=maxY,this.cellWidth[cellId]=maxX-minX,this.cellHeight[cellId]=maxY-minY,this.cellRegion[cellId]=region.id,this.cellRow[cellId]=row,this.cellCol[cellId]=col;let minBorderDist=Math.min(this.cellCenterX[cellId]-this.boundsMinX,this.boundsMaxX-this.cellCenterX[cellId],this.cellCenterY[cellId]-this.boundsMinY,this.boundsMaxY-this.cellCenterY[cellId]);this.viaAllowed[cellId]=minBorderDist>=this.viaMinDistFromBorder?1:0}}}let neighbors=Array.from({length:this.planeSize},()=>[]),addBidirectionalEdge=(a3,b3)=>{if(a3===b3||a3<0||b3<0)return;let dx3=this.cellCenterX[a3]-this.cellCenterX[b3],dy3=this.cellCenterY[a3]-this.cellCenterY[b3],cost=Math.hypot(dx3,dy3);pushUniqueNeighbor2(neighbors[a3],{cellId:b3,cost}),pushUniqueNeighbor2(neighbors[b3],{cellId:a3,cost})};for(let regionIdx=0;regionIdx<this.regions.length;regionIdx++){let region=this.regions[regionIdx];for(let row=0;row<region.rows;row++)for(let col=0;col<region.cols;col++){let cellId=this.cellIdFor(region.id,row,col);row+1<region.rows&&addBidirectionalEdge(cellId,this.cellIdFor(region.id,row+1,col)),col+1<region.cols&&addBidirectionalEdge(cellId,this.cellIdFor(region.id,row,col+1))}}let left=this.regions[REGION_LEFT],top=this.regions[REGION_TOP],right=this.regions[REGION_RIGHT],bottom=this.regions[REGION_BOTTOM],middle=this.regions[REGION_MIDDLE],hasLeft=left.rows>0&&left.cols>0,hasTop=top.rows>0&&top.cols>0,hasRight=right.rows>0&&right.cols>0,hasBottom=bottom.rows>0&&bottom.cols>0,hasMiddle=middle.rows>0&&middle.cols>0;if(hasLeft&&hasTop)for(let globalRow=0;globalRow<this.bandRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_LEFT,globalRow,left.cols-1),this.cellIdFor(REGION_TOP,globalRow,0));if(hasTop&&hasRight)for(let globalRow=0;globalRow<this.bandRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_TOP,globalRow,top.cols-1),this.cellIdFor(REGION_RIGHT,globalRow,0));if(hasLeft&&hasBottom)for(let globalRow=this.fineRows-this.bandRows;globalRow<this.fineRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_LEFT,globalRow,left.cols-1),this.cellIdFor(REGION_BOTTOM,globalRow-(this.fineRows-this.bandRows),0));if(hasBottom&&hasRight)for(let globalRow=this.fineRows-this.bandRows;globalRow<this.fineRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_BOTTOM,globalRow-(this.fineRows-this.bandRows),bottom.cols-1),this.cellIdFor(REGION_RIGHT,globalRow,0));if(hasLeft&&hasMiddle)for(let globalRow=this.bandRows;globalRow<this.fineRows-this.bandRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_LEFT,globalRow,left.cols-1),this.cellIdFor(REGION_MIDDLE,Math.floor((globalRow-this.bandRows)/this.lowScale),0));if(hasRight&&hasMiddle)for(let globalRow=this.bandRows;globalRow<this.fineRows-this.bandRows;globalRow++)addBidirectionalEdge(this.cellIdFor(REGION_MIDDLE,Math.floor((globalRow-this.bandRows)/this.lowScale),middle.cols-1),this.cellIdFor(REGION_RIGHT,globalRow,0));if(hasTop&&hasMiddle)for(let globalCol=this.bandCols;globalCol<this.fineCols-this.bandCols;globalCol++)addBidirectionalEdge(this.cellIdFor(REGION_TOP,top.rows-1,globalCol-this.bandCols),this.cellIdFor(REGION_MIDDLE,0,Math.floor((globalCol-this.bandCols)/this.lowScale)));if(hasBottom&&hasMiddle)for(let globalCol=this.bandCols;globalCol<this.fineCols-this.bandCols;globalCol++)addBidirectionalEdge(this.cellIdFor(REGION_MIDDLE,middle.rows-1,Math.floor((globalCol-this.bandCols)/this.lowScale)),this.cellIdFor(REGION_BOTTOM,0,globalCol-this.bandCols));if(!hasMiddle&&!hasTop&&!hasBottom&&hasLeft&&hasRight)for(let row=0;row<Math.min(left.rows,right.rows);row++)addBidirectionalEdge(this.cellIdFor(REGION_LEFT,row,left.cols-1),this.cellIdFor(REGION_RIGHT,row,0));if(!hasMiddle&&!hasLeft&&!hasRight&&hasTop&&hasBottom)for(let col=0;col<Math.min(top.cols,bottom.cols);col++)addBidirectionalEdge(this.cellIdFor(REGION_TOP,top.rows-1,col),this.cellIdFor(REGION_BOTTOM,0,col));let flattened=this.flattenNeighborLists(neighbors);this.neighborOffset=flattened.offset,this.neighborIds=flattened.ids,this.neighborCosts=flattened.costs}cellIdFor(regionId,row,col){let region=this.regions[regionId];return region.offset+row*region.cols+col}stepOnce(){if(!this.activeConnSeg){if(this.unsolvedSegs.length===0){this.solved=!0;return}let next2=this.unsolvedSegs.shift();this.activeConnSeg=next2,this.activeConnId=next2.connId,this.nodePool.clear(),this.ripChain.clear(),this.heap.clear(),this.seqCounter=0,this.searchIterations=0,this.nextStamp();let f3=this.computeH(next2.startZ,next2.startCellId,next2.endZ,next2.endCellId)*this.hyperParameters.greedyMultiplier,startIdx=this.nodePool.push(next2.startZ,next2.startCellId,0,-1,-1,0),startFlatIdx=next2.startZ*this.planeSize+next2.startCellId,startStateIdx=this.getSearchStateIdx(startFlatIdx,0);this.bestGStamp[startStateIdx]=this.stamp,this.bestGValue[startStateIdx]=0,this.heap.push(f3,this.seqCounter++,startIdx);return}this.searchIterations++;let connRips=this.ripCount[this.activeConnId]??0,budget=Math.round(this.baseSearchBudgetIters*(1+Math.min(connRips,10)*.25));if(this.searchIterations>budget){let pen=this.penalty2d;for(let i3=0;i3<pen.length;i3++)pen[i3]=pen[i3]*.9;this.unsolvedSegs.push(this.activeConnSeg),this.activeConnSeg=null,this.activeConnId=-1,this.heap.clear(),this.nodePool.clear(),this.consecutiveSkips++,this.consecutiveSkips>=Math.max(3,this.unsolvedSegs.length*3)&&(this.error=`Convergence failure: ${this.unsolvedSegs.length} connections stuck`,this.failed=!0);return}if(this.heap.size===0){this.error=`No path found for ${this.connIdToName[this.activeConnId]}`,this.failed=!0;return}let nodeIdx=this.heap.pop(),z4=this.nodePool.z[nodeIdx],cellId=this.nodePool.cellId[nodeIdx],g6=this.nodePool.g[nodeIdx],rippedHead=this.nodePool.ripHead[nodeIdx],ripCount=this.nodePool.ripCount[nodeIdx],flatIdx=z4*this.planeSize+cellId,searchStateIdx=this.getSearchStateIdx(flatIdx,ripCount);if(this.visitedStamp[searchStateIdx]===this.stamp)return;this.visitedStamp[searchStateIdx]=this.stamp,this.visitedFlatStamp[flatIdx]=this.stamp;let seg=this.activeConnSeg;if(z4===seg.endZ&&cellId===seg.endCellId){this.finalizeRoute(nodeIdx),this.activeConnSeg=null,this.activeConnId=-1;return}let visited=this.visitedStamp,stamp=this.stamp,activeConn=this.activeConnId,endZ=seg.endZ,endCellId=seg.endCellId,neighborStart=this.neighborOffset[cellId],neighborEnd=this.neighborOffset[cellId+1];for(let i3=neighborStart;i3<neighborEnd;i3++){let neighborCellId=this.neighborIds[i3],nextFlatIdx=z4*this.planeSize+neighborCellId;if(this.computeMoveCostAndRips(activeConn,z4,neighborCellId,!1,rippedHead,ripCount,this.neighborCosts[i3]),this._moveCost<0)continue;let nextStateIdx=this.getSearchStateIdx(nextFlatIdx,this._moveRipCount);if(visited[nextStateIdx]===stamp)continue;let g22=g6+this._moveCost;if(this.bestGStamp[nextStateIdx]===stamp&&g22>=this.bestGValue[nextStateIdx])continue;this.bestGStamp[nextStateIdx]=stamp,this.bestGValue[nextStateIdx]=g22;let f22=g22+this.computeH(z4,neighborCellId,endZ,endCellId)*this.hyperParameters.greedyMultiplier,newNodeIdx=this.nodePool.push(z4,neighborCellId,g22,nodeIdx,this._moveRippedHead,this._moveRipCount);this.heap.push(f22,this.seqCounter++,newNodeIdx)}if(this.viaAllowed[cellId])for(let nz2=0;nz2<this.layers;nz2++){if(nz2===z4)continue;let nextFlatIdx=nz2*this.planeSize+cellId;if(this.computeMoveCostAndRips(activeConn,nz2,cellId,!0,rippedHead,ripCount,0),this._moveCost<0)continue;let nextStateIdx=this.getSearchStateIdx(nextFlatIdx,this._moveRipCount);if(visited[nextStateIdx]===stamp)continue;let g22=g6+this._moveCost;if(this.bestGStamp[nextStateIdx]===stamp&&g22>=this.bestGValue[nextStateIdx])continue;this.bestGStamp[nextStateIdx]=stamp,this.bestGValue[nextStateIdx]=g22;let f22=g22+this.computeH(nz2,cellId,endZ,endCellId)*this.hyperParameters.greedyMultiplier,newNodeIdx=this.nodePool.push(nz2,cellId,g22,nodeIdx,this._moveRippedHead,this._moveRipCount);this.heap.push(f22,this.seqCounter++,newNodeIdx)}}computeMoveCostAndRips(activeConn,toZ,toCellId,isVia,rippedHead,currentRipCount,lateralCost){let cost=0,head=rippedHead,ripCount=currentRipCount,toFlatIdx=toZ*this.planeSize+toCellId;if(isVia){cost+=this.hyperParameters.viaBaseCost,cost+=Math.min(this.penalty2d[toCellId],this.penaltyCap);let fixedOwner=this.portOwnerFlat[toFlatIdx],allowFixedOverlap=this.allowSharedUse(activeConn,fixedOwner),seg=this.activeConnSeg,isSegEnd=!!seg&&toZ===seg.endZ&&toCellId===seg.endCellId;if(fixedOwner>=0&&fixedOwner!==activeConn&&!allowFixedOverlap&&!isSegEnd){this._moveCost=-1,this._moveRippedHead=head;return}this.fillViaOccupants(toCellId,activeConn);let occs=this._viaOccs;for(let i3=0;i3<occs.length;i3++){let occ=occs[i3];this.ripChain.contains(head,occ)||(cost+=this.hyperParameters.ripCost,head=this.ripChain.append(head,occ),ripCount++),cost+=this.hyperParameters.ripViaPenalty}}else{cost+=lateralCost,cost+=Math.min(this.penalty2d[toCellId],this.penaltyCap);let fixedOwner=this.portOwnerFlat[toFlatIdx],allowFixedOverlap=this.allowSharedUse(activeConn,fixedOwner),seg=this.activeConnSeg,isSegEnd=!!seg&&toZ===seg.endZ&&toCellId===seg.endCellId;if(fixedOwner>=0&&fixedOwner!==activeConn&&!allowFixedOverlap&&!isSegEnd){this._moveCost=-1,this._moveRippedHead=head;return}this.fillTraceOccupants(toFlatIdx,activeConn,this._cellOccs);for(let i3=0;i3<this._cellOccs.length;i3++){let occ=this._cellOccs[i3];this.ripChain.contains(head,occ)||(cost+=this.hyperParameters.ripCost,head=this.ripChain.append(head,occ),ripCount++),cost+=this.hyperParameters.ripTracePenalty}}this._moveCost=cost,this._moveRippedHead=head,this._moveRipCount=ripCount}fillViaOccupants(cellId,activeConn){let occs=this._viaOccs;occs.length=0;let cx3=this.cellCenterX[cellId],cy3=this.cellCenterY[cellId];this.forEachCellNearCircle(cx3,cy3,this.viaKeepoutRadius,occCellId=>{if(circleIntersectsRect2(cx3,cy3,this.viaKeepoutRadius,this.cellMinX[occCellId],this.cellMinY[occCellId],this.cellMaxX[occCellId],this.cellMaxY[occCellId]))for(let z4=0;z4<this.layers;z4++)this.pushFlatOccupants(z4*this.planeSize+occCellId,activeConn,occs)})}fillTraceOccupants(flatIdx,activeConn,out){out.length=0,this.pushFlatOccupants(flatIdx,activeConn,out)}pushFlatOccupants(flatIdx,activeConn,out){let primaryOcc=this.usedCellsFlat[flatIdx];primaryOcc!==-1&&primaryOcc!==activeConn&&!this.allowSharedUse(activeConn,primaryOcc)&&pushUnique2(out,primaryOcc);let sharedOccs=this.sharedCellsFlat[flatIdx];if(sharedOccs)for(let i3=0;i3<sharedOccs.length;i3++){let occ=sharedOccs[i3];occ!==activeConn&&(this.allowSharedUse(activeConn,occ)||pushUnique2(out,occ))}}addSharedOccupant(flatIdx,connId){if(this.usedCellsFlat[flatIdx]===connId)return;let sharedOccs=this.sharedCellsFlat[flatIdx];sharedOccs||(sharedOccs=[],this.sharedCellsFlat[flatIdx]=sharedOccs),pushUnique2(sharedOccs,connId)}replaceOccupants(flatIdx,connId){this.usedCellsFlat[flatIdx]=connId,this.sharedCellsFlat[flatIdx]=void 0}removeOccupant(flatIdx,connId){let sharedOccs=this.sharedCellsFlat[flatIdx];if(this.usedCellsFlat[flatIdx]===connId){sharedOccs&&sharedOccs.length>0?(this.usedCellsFlat[flatIdx]=sharedOccs.pop(),sharedOccs.length===0&&(this.sharedCellsFlat[flatIdx]=void 0)):this.usedCellsFlat[flatIdx]=-1;return}if(!sharedOccs)return;let idx=sharedOccs.indexOf(connId);idx!==-1&&(sharedOccs.splice(idx,1),sharedOccs.length===0&&(this.sharedCellsFlat[flatIdx]=void 0))}allowSharedUse(activeConn,existingConn){return existingConn<0?!1:this.connIdToRootNet[existingConn]===this.connIdToRootNet[activeConn]}shouldSkipFixedPortHalo(flatIdx,connId){let fixedOwner=this.portOwnerFlat[flatIdx];return fixedOwner===connId?!1:fixedOwner===-2?!0:fixedOwner<0?!1:!this.allowSharedUse(connId,fixedOwner)}nextStamp(){this.stamp=this.stamp+1>>>0,this.stamp===0&&(this.visitedStamp.fill(0),this.bestGStamp.fill(0),this.visitedFlatStamp.fill(0),this.stamp=1)}getSearchStateIdx(flatIdx,ripCount){return flatIdx}computeH(z4,cellId,toZ,toCellId){let dist=Math.hypot(this.cellCenterX[cellId]-this.cellCenterX[toCellId],this.cellCenterY[cellId]-this.cellCenterY[toCellId]);return z4===toZ?dist:dist+this.hyperParameters.viaBaseCost}internConn(name,rootNetName){let existing=this.connNameToId.get(name);if(existing!==void 0)return existing;let id2=this.connIdToName.length;return this.connIdToName.push(name),this.connIdToRootNet.push(toRootNetName3(name,rootNetName)),this.connNameToId.set(name,id2),id2}buildConnectionSegs(){let byName=new Map;for(let pp3 of this.nodeWithPortPoints.portPoints){let name=pp3.connectionName;byName.has(name)||byName.set(name,{points:[],rootConnectionName:pp3.rootConnectionName}),byName.get(name).points.push(pp3)}let segs=[],seenSegmentKeys=new Set;for(let[name,conn]of byName){let pts=conn.points;if(pts.length<2)continue;let connId=this.internConn(name,conn.rootConnectionName);for(let i3=0;i3<pts.length-1;i3++){let s3=this.pointToCell(pts[i3]),e5=this.pointToCell(pts[i3+1]),endpointA=`${s3.z}:${s3.cellId}`,endpointB=`${e5.z}:${e5.cellId}`,orderedEndpoints=endpointA<endpointB?`${endpointA}|${endpointB}`:`${endpointB}|${endpointA}`,netName=conn.rootConnectionName??name,segKey=`${netName}|${orderedEndpoints}`;if(seenSegmentKeys.has(segKey)){this.overlapFriendlyRootNets.add(netName);continue}seenSegmentKeys.add(segKey),segs.push({connId,startZ:s3.z,startCellId:s3.cellId,startPoint:pts[i3],endZ:e5.z,endCellId:e5.cellId,endPoint:pts[i3+1]})}}return segs}pointToCell(pt3){let fineCol=clamp32(Math.floor((pt3.x-this.boundsMinX)/this.highResolutionCellSize),0,this.fineCols-1),fineRow=clamp32(Math.floor((pt3.y-this.boundsMinY)/this.highResolutionCellSize),0,this.fineRows-1),regionId=REGION_MIDDLE;fineCol<this.bandCols?regionId=REGION_LEFT:fineCol>=this.fineCols-this.bandCols?regionId=REGION_RIGHT:fineRow<this.bandRows?regionId=REGION_TOP:fineRow>=this.fineRows-this.bandRows&&(regionId=REGION_BOTTOM);let region=this.regions[regionId],localFineRow=fineRow-region.fineOriginRow,localFineCol=fineCol-region.fineOriginCol,row=clamp32(Math.floor(localFineRow/region.cellScale),0,Math.max(0,region.rows-1)),col=clamp32(Math.floor(localFineCol/region.cellScale),0,Math.max(0,region.cols-1));return{z:this.zToLayer.get(pt3.z)??0,cellId:this.cellIdFor(regionId,row,col)}}shuffleConnections(){let arr=this.unsolvedSegs,s3=this.hyperParameters.shuffleSeed>>>0,rng=()=>(s3=Math.imul(s3,1664525)+1013904223>>>0,s3/4294967295);for(let i3=arr.length-1;i3>0;i3--){let j4=Math.floor(rng()*(i3+1)),tmp=arr[i3];arr[i3]=arr[j4],arr[j4]=tmp}}finalizeRoute(goalNodeIdx){this.consecutiveSkips=Math.max(0,this.consecutiveSkips-1);let states=[],idx=goalNodeIdx;for(;idx>=0;){let z4=this.nodePool.z[idx],cellId=this.nodePool.cellId[idx];states.push(z4*this.planeSize+cellId),idx=this.nodePool.parent[idx]}for(states.reverse();states.length>1&&this.sharedCrossRootPortFlat[states[0]];)states.shift();for(;states.length>1&&this.sharedCrossRootPortFlat[states[states.length-1]];)states.pop();let viaCellIds=this.extractViaCellIds(states),connId=this.activeConnId;this.ripChain.collect(this.nodePool.ripHead[goalNodeIdx],this._rippedIds);for(let i3=0;i3<this._rippedIds.length;i3++)if(this.ripTrace(this._rippedIds[i3]),this.failed)return;let indices=[];for(let i3=0;i3<states.length;i3++){let state2=states[i3],z4=Math.floor(state2/this.planeSize),cellId=state2-z4*this.planeSize;this.markTraceFootprint(connId,z4,cellId,indices)}let displacedByVias=[];for(let i3=0;i3<viaCellIds.length;i3++)this.markViaFootprint(connId,viaCellIds[i3],indices,displacedByVias);for(;this.usedIndicesByConn.length<=connId;)this.usedIndicesByConn.push(void 0);for(this.usedIndicesByConn[connId]=indices;this.solvedRoutes.length<=connId;)this.solvedRoutes.push(void 0);this.solvedRoutes[connId]={connId,states:Int32Array.from(states),viaCellIds:Int32Array.from(viaCellIds),startPoint:this.activeConnSeg.startPoint,endPoint:this.activeConnSeg.endPoint};for(let i3=0;i3<displacedByVias.length;i3++)if(this.ripTrace(displacedByVias[i3]),this.failed)return;if(this._rippedIds.length>0||displacedByVias.length>0){let pen=this.penalty2d,cap2=this.penaltyCap;if(this.totalRipEvents>50)for(let i3=0;i3<pen.length;i3++)pen[i3]=pen[i3]*.99;else for(let i3=0;i3<pen.length;i3++)pen[i3]>cap2&&(pen[i3]=pen[i3]*.5)}}extractViaCellIds(states){let viaCellIds=[];for(let i3=1;i3<states.length;i3++){let prevState=states[i3-1],nextState=states[i3],prevZ=Math.floor(prevState/this.planeSize),nextZ=Math.floor(nextState/this.planeSize);prevZ!==nextZ&&viaCellIds.push(nextState-nextZ*this.planeSize)}return viaCellIds}markTraceFootprint(connId,z4,sourceCellId,indices){let cx3=this.cellCenterX[sourceCellId],cy3=this.cellCenterY[sourceCellId];this.forEachCellNearCircle(cx3,cy3,this.traceKeepoutRadius,cellId=>{if(!circleIntersectsRect2(cx3,cy3,this.traceKeepoutRadius,this.cellMinX[cellId],this.cellMinY[cellId],this.cellMaxX[cellId],this.cellMaxY[cellId]))return;let flatIdx=z4*this.planeSize+cellId;if(cellId!==sourceCellId&&this.shouldSkipFixedPortHalo(flatIdx,connId))return;let existing=this.usedCellsFlat[flatIdx],allowSameRootOverlap=this.allowSharedUse(connId,existing);existing!==-1&&existing!==connId&&!allowSameRootOverlap||(existing!==-1&&existing!==connId?this.addSharedOccupant(flatIdx,connId):this.usedCellsFlat[flatIdx]=connId,indices.push(flatIdx))})}markViaFootprint(connId,sourceCellId,indices,displacedByVias){let cx3=this.cellCenterX[sourceCellId],cy3=this.cellCenterY[sourceCellId];this.forEachCellNearCircle(cx3,cy3,this.viaKeepoutRadius,cellId=>{if(circleIntersectsRect2(cx3,cy3,this.viaKeepoutRadius,this.cellMinX[cellId],this.cellMinY[cellId],this.cellMaxX[cellId],this.cellMaxY[cellId]))for(let z4=0;z4<this.layers;z4++){let flatIdx=z4*this.planeSize+cellId;if(cellId!==sourceCellId&&this.shouldSkipFixedPortHalo(flatIdx,connId))continue;if(this.fillTraceOccupants(flatIdx,connId,this._cellOccs),this._cellOccs.length>0){for(let i3=0;i3<this._cellOccs.length;i3++)pushUnique2(displacedByVias,this._cellOccs[i3]);this.replaceOccupants(flatIdx,connId),indices.push(flatIdx);continue}let existing=this.usedCellsFlat[flatIdx];existing!==-1&&existing!==connId?this.addSharedOccupant(flatIdx,connId):this.usedCellsFlat[flatIdx]=connId,indices.push(flatIdx)}})}forEachCellNearCircle(cx3,cy3,radius,visitor){let minFineCol=clamp32(Math.floor((cx3-radius-this.boundsMinX)/this.highResolutionCellSize),0,this.fineCols-1),maxFineCol=clamp32(Math.floor((cx3+radius-this.boundsMinX)/this.highResolutionCellSize),0,this.fineCols-1),minFineRow=clamp32(Math.floor((cy3-radius-this.boundsMinY)/this.highResolutionCellSize),0,this.fineRows-1),maxFineRow=clamp32(Math.floor((cy3+radius-this.boundsMinY)/this.highResolutionCellSize),0,this.fineRows-1);for(let regionIdx=0;regionIdx<this.regions.length;regionIdx++){let region=this.regions[regionIdx];if(region.rows===0||region.cols===0)continue;let regionFineRowMin=Math.max(minFineRow,region.fineOriginRow),regionFineRowMax=Math.min(maxFineRow,region.fineOriginRow+region.fineRows-1),regionFineColMin=Math.max(minFineCol,region.fineOriginCol),regionFineColMax=Math.min(maxFineCol,region.fineOriginCol+region.fineCols-1);if(regionFineRowMin>regionFineRowMax||regionFineColMin>regionFineColMax)continue;let localRowMin=Math.floor((regionFineRowMin-region.fineOriginRow)/region.cellScale),localRowMax=Math.floor((regionFineRowMax-region.fineOriginRow)/region.cellScale),localColMin=Math.floor((regionFineColMin-region.fineOriginCol)/region.cellScale),localColMax=Math.floor((regionFineColMax-region.fineOriginCol)/region.cellScale);for(let row=localRowMin;row<=localRowMax;row++)for(let col=localColMin;col<=localColMax;col++)visitor(this.cellIdFor(region.id,row,col))}}ripTrace(connId){for(;this.ripCount.length<=connId;)this.ripCount.push(0);if(this.ripCount[connId]++,this.totalRipEvents++,this.totalRipEvents>=this.MAX_RIPS){this.error=`Convergence failure: exceeded MAX_RIPS ${this.MAX_RIPS}`,this.failed=!0;return}let route=this.solvedRoutes[connId];if(route){for(let i3=0;i3<route.states.length;i3++){let cellId=route.states[i3]%this.planeSize;this.penalty2d[cellId]=this.penalty2d[cellId]+this.hyperParameters.ripTracePenalty}for(let i3=0;i3<route.viaCellIds.length;i3++){let cellId=route.viaCellIds[i3];this.penalty2d[cellId]=this.penalty2d[cellId]+this.hyperParameters.ripViaPenalty}}let indices=this.usedIndicesByConn[connId];if(indices){for(let i3=0;i3<indices.length;i3++)this.removeOccupant(indices[i3],connId);this.usedIndicesByConn[connId]=void 0}if(route){this.solvedRoutes[connId]=void 0;let first=route.states[0],last=route.states[route.states.length-1],startZ=Math.floor(first/this.planeSize),endZ=Math.floor(last/this.planeSize);this.unsolvedSegs.push({connId,startZ,startCellId:first-startZ*this.planeSize,startPoint:route.startPoint,endZ,endCellId:last-endZ*this.planeSize,endPoint:route.endPoint})}}flattenNeighborLists(neighbors){let offset=new Int32Array(neighbors.length+1),total=0;for(let i3=0;i3<neighbors.length;i3++)offset[i3]=total,total+=neighbors[i3].length;offset[neighbors.length]=total;let ids=new Int32Array(total),costs=new Float32Array(total),cursor=0;for(let i3=0;i3<neighbors.length;i3++){let edges=neighbors[i3];for(let j4=0;j4<edges.length;j4++){let edge=edges[j4];ids[cursor]=edge.cellId,costs[cursor]=edge.cost,cursor++}}return{offset,ids,costs}}visualize(){let LAYER_COLORS2=["red","blue","orange","green"],vt3=this.gridToBoundsTransform,points=[],lines=[],circles=[],rects=[];if(rects.push({center:{x:this.nodeWithPortPoints.center.x,y:this.nodeWithPortPoints.center.y},width:this.nodeWithPortPoints.width,height:this.nodeWithPortPoints.height,stroke:"gray"}),this.showPenaltyMap&&this.penalty2d){let maxPenalty=0;for(let i3=0;i3<this.penalty2d.length;i3++)this.penalty2d[i3]>maxPenalty&&(maxPenalty=this.penalty2d[i3]);if(maxPenalty>0)for(let cellId=0;cellId<this.planeSize;cellId++){let penalty=this.penalty2d[cellId];if(penalty<=0)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]}),alpha=Math.min(.6,penalty/maxPenalty*.6);rects.push({center:tc3,width:this.cellWidth[cellId]*vt3.a,height:this.cellHeight[cellId]*vt3.e,fill:`rgba(255,165,0,${alpha.toFixed(3)})`})}}if(this.showUsedCellMap&&this.usedCellsFlat)for(let z4=0;z4<this.layers;z4++){let zBase=z4*this.planeSize;for(let cellId=0;cellId<this.planeSize;cellId++){if(this.usedCellsFlat[zBase+cellId]===-1)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]});rects.push({center:tc3,width:this.cellWidth[cellId]*vt3.a,height:this.cellHeight[cellId]*vt3.e,fill:"rgba(0,0,255,0.5)"})}}for(let pp3 of this.nodeWithPortPoints.portPoints)points.push({x:pp3.x,y:pp3.y,color:LAYER_COLORS2[pp3.z]??"gray",label:pp3.connectionName});let TRACE_COLORS3=["rgba(255,0,0,0.75)","rgba(0,0,255,0.75)","rgba(255,165,0,0.75)","rgba(0,128,0,0.75)"],transformedRoutes=this.getOutput();for(let route of transformedRoutes){if(route.route.length<2)continue;let segStart=0;for(let i3=1;i3<route.route.length;i3++){let prev=route.route[i3-1];route.route[i3].z!==prev.z&&(i3-segStart>=2&&lines.push({points:route.route.slice(segStart,i3).map(p4=>({x:p4.x,y:p4.y})),strokeColor:TRACE_COLORS3[prev.z]??"rgba(128,128,128,0.75)",strokeWidth:this.traceThickness}),segStart=i3)}if(route.route.length-segStart>=2){let lastZ=route.route[segStart].z;lines.push({points:route.route.slice(segStart).map(p4=>({x:p4.x,y:p4.y})),strokeColor:TRACE_COLORS3[lastZ]??"rgba(128,128,128,0.75)",strokeWidth:this.traceThickness})}}for(let route of transformedRoutes)for(let via of route.vias)circles.push({center:{x:via.x,y:via.y},radius:this.viaDiameter/2,fill:"rgba(0,0,0,0.3)",stroke:"black"});if(this.activeConnSeg&&this.visitedFlatStamp){let currentStamp=this.stamp;for(let z4=0;z4<this.layers;z4++){let zBase=z4*this.planeSize;for(let cellId=0;cellId<this.planeSize;cellId++){if(this.visitedFlatStamp[zBase+cellId]!==currentStamp)continue;let tc3=applyAffineTransformToPoint(vt3,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]});points.push({x:tc3.x,y:tc3.y,color:"rgba(0,0,255,0.2)"})}}}return{points,lines,circles,rects,coordinateSystem:"cartesian",title:`HighDensityA03 [${this.getSolvedRouteCount()} solved, ${this.unsolvedSegs?.length??0} remaining]`}}getOutput(){let t52=this.gridToBoundsTransform,result=[];for(let connId=0;connId<this.solvedRoutes.length;connId++){let route=this.solvedRoutes[connId];if(!route)continue;let connName=this.connIdToName[connId],points=Array.from(route.states,state2=>{let z4=Math.floor(state2/this.planeSize),cellId=state2-z4*this.planeSize,tp3=applyAffineTransformToPoint(t52,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]});return{x:tp3.x,y:tp3.y,z:this.layerToZ.get(z4)??z4}});points.length>0&&(points[0]={...route.startPoint},points.length>1&&(points[points.length-1]={...route.endPoint})),result.push({connectionName:connName,traceThickness:this.traceThickness,viaDiameter:this.viaDiameter,route:points,vias:Array.from(route.viaCellIds,cellId=>applyAffineTransformToPoint(t52,{x:this.cellCenterX[cellId],y:this.cellCenterY[cellId]}))})}return result}getSolvedRouteCount(){let count=0;for(let i3=0;i3<this.solvedRoutes.length;i3++)this.solvedRoutes[i3]&&count++;return count}computeGridToBoundsTransform(){let minCenterX=1/0,maxCenterX=-1/0,minCenterY=1/0,maxCenterY=-1/0;for(let cellId=0;cellId<this.planeSize;cellId++){let centerX=this.cellCenterX[cellId],centerY=this.cellCenterY[cellId];centerX<minCenterX&&(minCenterX=centerX),centerX>maxCenterX&&(maxCenterX=centerX),centerY<minCenterY&&(minCenterY=centerY),centerY>maxCenterY&&(maxCenterY=centerY)}let xSpan=maxCenterX-minCenterX,ySpan=maxCenterY-minCenterY,width=this.boundsMaxX-this.boundsMinX,height=this.boundsMaxY-this.boundsMinY,a3=xSpan>0?width/xSpan:1,e5=ySpan>0?height/ySpan:1,c4=xSpan>0?this.boundsMinX-a3*minCenterX:(this.boundsMinX+this.boundsMaxX)/2-minCenterX,f3=ySpan>0?this.boundsMinY-e5*minCenterY:(this.boundsMinY+this.boundsMaxY)/2-minCenterY;return{a:a3,b:0,c:c4,d:0,e:e5,f:f3}}};var ROUNDING_PRECISION=1e3;var BOUNDARY_INSET=1/ROUNDING_PRECISION;var VIA_BORDER_EXTRA_CLEARANCE=.15,VIA_SEGMENT_TARGET_CLEARANCE=.4;var VIA_BORDER_TARGET_CLEARANCE=VIA_SEGMENT_TARGET_CLEARANCE+VIA_BORDER_EXTRA_CLEARANCE+.1,VIA_BORDER_FALLOFF_DISTANCE=VIA_BORDER_TARGET_CLEARANCE+.05;var defaultParams={cellSizeMm:.1,traceMargin:.15,traceThickness:.1,viaDiameter:.3,viaMinDistFromBorder:.15},defaultA03Params={highResolutionCellSize:.1,highResolutionCellThickness:8,lowResolutionCellSize:.4,traceMargin:.15,traceThickness:.1,viaDiameter:.3,viaMinDistFromBorder:.15},defaultA08Params={...defaultParams,stepMultiplier:1,showPenaltyMap:!1,showUsedCellMap:!1,effort:1,initialRectMarginMm:.2,rectShrinkStepMm:.1,breakoutTraceMarginMm:.1,breakoutSegmentCount:2,breakoutMaxIterationsPerRect:60,breakoutForceStepSize:.2,breakoutRepulsionStrength:1.8,breakoutSmoothingStrength:.16,breakoutAttractionStrength:.06,innerPortSpreadFactor:1},defaultA09Params={...defaultA03Params,effort:1,boundaryBonus:.18,boundaryBonusSigma:.22,portShadowStrength:.55,portShadowTangentSigma:.18,portShadowDepthSigma:.5,fullOrderSearchConnectionCountLimit:6,priorityHeadSize:4,maxCandidateOrders:720};var import_object_hash=__toESM(require_object_hash(),1),import_object_hash2=__toESM(require_object_hash(),1),import_object_hash3=__toESM(require_object_hash(),1);var t=Object.create,e2=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,r3=Object.prototype.hasOwnProperty,s=(t52,e5)=>function(){return e5||(0,t52[o(t52)[0]])((e5={exports:{}}).exports,e5),e5.exports},a=(t52,n4)=>{for(var o4 in n4)e2(t52,o4,{get:n4[o4],enumerable:!0})},c=(s3,a3,c4)=>(c4=s3!=null?t(i(s3)):{},((t52,i3,s4,a4)=>{if(i3&&typeof i3=="object"||typeof i3=="function")for(let c5 of o(i3))r3.call(t52,c5)||c5===s4||e2(t52,c5,{get:()=>i3[c5],enumerable:!(a4=n(i3,c5))||a4.enumerable});return t52})(!a3&&s3&&s3.__esModule?c4:e2(c4,"default",{value:s3,enumerable:!0}),s3)),l=s({"node_modules/is-buffer/index.js"(t52,e5){function n4(t53){return!!t53.constructor&&typeof t53.constructor.isBuffer=="function"&&t53.constructor.isBuffer(t53)}e5.exports=function(t53){return t53!=null&&(n4(t53)||(function(t54){return typeof t54.readFloatLE=="function"&&typeof t54.slice=="function"&&n4(t54.slice(0,0))})(t53)||!!t53._isBuffer)}}}),h=s({"node_modules/kind-of/index.js"(t52,e5){var n4=l(),o4=Object.prototype.toString;e5.exports=function(t53){if(t53===void 0)return"undefined";if(t53===null)return"null";if(t53===!0||t53===!1||t53 instanceof Boolean)return"boolean";if(typeof t53=="string"||t53 instanceof String)return"string";if(typeof t53=="number"||t53 instanceof Number)return"number";if(typeof t53=="function"||t53 instanceof Function)return"function";if(Array.isArray!==void 0&&Array.isArray(t53))return"array";if(t53 instanceof RegExp)return"regexp";if(t53 instanceof Date)return"date";var e6=o4.call(t53);return e6==="[object RegExp]"?"regexp":e6==="[object Date]"?"date":e6==="[object Arguments]"?"arguments":e6==="[object Error]"?"error":n4(t53)?"buffer":e6==="[object Set]"?"set":e6==="[object WeakSet]"?"weakset":e6==="[object Map]"?"map":e6==="[object WeakMap]"?"weakmap":e6==="[object Symbol]"?"symbol":e6==="[object Int8Array]"?"int8array":e6==="[object Uint8Array]"?"uint8array":e6==="[object Uint8ClampedArray]"?"uint8clampedarray":e6==="[object Int16Array]"?"int16array":e6==="[object Uint16Array]"?"uint16array":e6==="[object Int32Array]"?"int32array":e6==="[object Uint32Array]"?"uint32array":e6==="[object Float32Array]"?"float32array":e6==="[object Float64Array]"?"float64array":"object"}}}),d=s({"node_modules/rename-keys/index.js"(t52,e5){(function(){function t53(t54,e6){if(typeof e6!="function")return t54;var n4={};for(var o4 in t54)Object.prototype.hasOwnProperty.call(t54,o4)&&(n4[e6(o4,t54[o4])||o4]=t54[o4]);return n4}e5!==void 0&&e5.exports?e5.exports=t53:typeof define=="function"&&define.amd?define([],function(){return t53}):window.rename=t53})()}}),u3=s({"node_modules/deep-rename-keys/index.js"(t52,e5){var n4=h(),o4=d();e5.exports=function t53(e6,i3){var r5=n4(e6);if(r5!=="object"&&r5!=="array")throw new Error("expected an object");var s3=[];for(var a3 in r5==="object"&&(e6=o4(e6,i3),s3={}),e6)if(e6.hasOwnProperty(a3)){var c4=e6[a3];n4(c4)==="object"||n4(c4)==="array"?s3[a3]=t53(c4,i3):s3[a3]=c4}return s3}}}),p=s({"node_modules/xml-reader/node_modules/eventemitter3/index.js"(t52,e5){var n4=Object.prototype.hasOwnProperty,o4="~";function i3(){}function r5(t53,e6,n5){this.fn=t53,this.context=e6,this.once=n5||!1}function s3(){this._events=new i3,this._eventsCount=0}Object.create&&(i3.prototype=Object.create(null),new i3().__proto__||(o4=!1)),s3.prototype.eventNames=function(){var t53,e6,i4=[];if(this._eventsCount===0)return i4;for(e6 in t53=this._events)n4.call(t53,e6)&&i4.push(o4?e6.slice(1):e6);return Object.getOwnPropertySymbols?i4.concat(Object.getOwnPropertySymbols(t53)):i4},s3.prototype.listeners=function(t53,e6){var n5=o4?o4+t53:t53,i4=this._events[n5];if(e6)return!!i4;if(!i4)return[];if(i4.fn)return[i4.fn];for(var r6=0,s4=i4.length,a3=new Array(s4);r6<s4;r6++)a3[r6]=i4[r6].fn;return a3},s3.prototype.emit=function(t53,e6,n5,i4,r6,s4){var a3=o4?o4+t53:t53;if(!this._events[a3])return!1;var c4,l4,h6=this._events[a3],d4=arguments.length;if(h6.fn){switch(h6.once&&this.removeListener(t53,h6.fn,void 0,!0),d4){case 1:return h6.fn.call(h6.context),!0;case 2:return h6.fn.call(h6.context,e6),!0;case 3:return h6.fn.call(h6.context,e6,n5),!0;case 4:return h6.fn.call(h6.context,e6,n5,i4),!0;case 5:return h6.fn.call(h6.context,e6,n5,i4,r6),!0;case 6:return h6.fn.call(h6.context,e6,n5,i4,r6,s4),!0}for(l4=1,c4=new Array(d4-1);l4<d4;l4++)c4[l4-1]=arguments[l4];h6.fn.apply(h6.context,c4)}else{var u5,p4=h6.length;for(l4=0;l4<p4;l4++)switch(h6[l4].once&&this.removeListener(t53,h6[l4].fn,void 0,!0),d4){case 1:h6[l4].fn.call(h6[l4].context);break;case 2:h6[l4].fn.call(h6[l4].context,e6);break;case 3:h6[l4].fn.call(h6[l4].context,e6,n5);break;case 4:h6[l4].fn.call(h6[l4].context,e6,n5,i4);break;default:if(!c4)for(u5=1,c4=new Array(d4-1);u5<d4;u5++)c4[u5-1]=arguments[u5];h6[l4].fn.apply(h6[l4].context,c4)}}return!0},s3.prototype.on=function(t53,e6,n5){var i4=new r5(e6,n5||this),s4=o4?o4+t53:t53;return this._events[s4]?this._events[s4].fn?this._events[s4]=[this._events[s4],i4]:this._events[s4].push(i4):(this._events[s4]=i4,this._eventsCount++),this},s3.prototype.once=function(t53,e6,n5){var i4=new r5(e6,n5||this,!0),s4=o4?o4+t53:t53;return this._events[s4]?this._events[s4].fn?this._events[s4]=[this._events[s4],i4]:this._events[s4].push(i4):(this._events[s4]=i4,this._eventsCount++),this},s3.prototype.removeListener=function(t53,e6,n5,r6){var s4=o4?o4+t53:t53;if(!this._events[s4])return this;if(!e6)return--this._eventsCount===0?this._events=new i3:delete this._events[s4],this;var a3=this._events[s4];if(a3.fn)a3.fn!==e6||r6&&!a3.once||n5&&a3.context!==n5||(--this._eventsCount===0?this._events=new i3:delete this._events[s4]);else{for(var c4=0,l4=[],h6=a3.length;c4<h6;c4++)(a3[c4].fn!==e6||r6&&!a3[c4].once||n5&&a3[c4].context!==n5)&&l4.push(a3[c4]);l4.length?this._events[s4]=l4.length===1?l4[0]:l4:--this._eventsCount===0?this._events=new i3:delete this._events[s4]}return this},s3.prototype.removeAllListeners=function(t53){var e6;return t53?(e6=o4?o4+t53:t53,this._events[e6]&&(--this._eventsCount===0?this._events=new i3:delete this._events[e6])):(this._events=new i3,this._eventsCount=0),this},s3.prototype.off=s3.prototype.removeListener,s3.prototype.addListener=s3.prototype.on,s3.prototype.setMaxListeners=function(){return this},s3.prefixed=o4,s3.EventEmitter=s3,e5!==void 0&&(e5.exports=s3)}}),m=s({"node_modules/xml-lexer/node_modules/eventemitter3/index.js"(t52,e5){var n4=Object.prototype.hasOwnProperty,o4="~";function i3(){}function r5(t53,e6,n5){this.fn=t53,this.context=e6,this.once=n5||!1}function s3(){this._events=new i3,this._eventsCount=0}Object.create&&(i3.prototype=Object.create(null),new i3().__proto__||(o4=!1)),s3.prototype.eventNames=function(){var t53,e6,i4=[];if(this._eventsCount===0)return i4;for(e6 in t53=this._events)n4.call(t53,e6)&&i4.push(o4?e6.slice(1):e6);return Object.getOwnPropertySymbols?i4.concat(Object.getOwnPropertySymbols(t53)):i4},s3.prototype.listeners=function(t53,e6){var n5=o4?o4+t53:t53,i4=this._events[n5];if(e6)return!!i4;if(!i4)return[];if(i4.fn)return[i4.fn];for(var r6=0,s4=i4.length,a3=new Array(s4);r6<s4;r6++)a3[r6]=i4[r6].fn;return a3},s3.prototype.emit=function(t53,e6,n5,i4,r6,s4){var a3=o4?o4+t53:t53;if(!this._events[a3])return!1;var c4,l4,h6=this._events[a3],d4=arguments.length;if(h6.fn){switch(h6.once&&this.removeListener(t53,h6.fn,void 0,!0),d4){case 1:return h6.fn.call(h6.context),!0;case 2:return h6.fn.call(h6.context,e6),!0;case 3:return h6.fn.call(h6.context,e6,n5),!0;case 4:return h6.fn.call(h6.context,e6,n5,i4),!0;case 5:return h6.fn.call(h6.context,e6,n5,i4,r6),!0;case 6:return h6.fn.call(h6.context,e6,n5,i4,r6,s4),!0}for(l4=1,c4=new Array(d4-1);l4<d4;l4++)c4[l4-1]=arguments[l4];h6.fn.apply(h6.context,c4)}else{var u5,p4=h6.length;for(l4=0;l4<p4;l4++)switch(h6[l4].once&&this.removeListener(t53,h6[l4].fn,void 0,!0),d4){case 1:h6[l4].fn.call(h6[l4].context);break;case 2:h6[l4].fn.call(h6[l4].context,e6);break;case 3:h6[l4].fn.call(h6[l4].context,e6,n5);break;case 4:h6[l4].fn.call(h6[l4].context,e6,n5,i4);break;default:if(!c4)for(u5=1,c4=new Array(d4-1);u5<d4;u5++)c4[u5-1]=arguments[u5];h6[l4].fn.apply(h6[l4].context,c4)}}return!0},s3.prototype.on=function(t53,e6,n5){var i4=new r5(e6,n5||this),s4=o4?o4+t53:t53;return this._events[s4]?this._events[s4].fn?this._events[s4]=[this._events[s4],i4]:this._events[s4].push(i4):(this._events[s4]=i4,this._eventsCount++),this},s3.prototype.once=function(t53,e6,n5){var i4=new r5(e6,n5||this,!0),s4=o4?o4+t53:t53;return this._events[s4]?this._events[s4].fn?this._events[s4]=[this._events[s4],i4]:this._events[s4].push(i4):(this._events[s4]=i4,this._eventsCount++),this},s3.prototype.removeListener=function(t53,e6,n5,r6){var s4=o4?o4+t53:t53;if(!this._events[s4])return this;if(!e6)return--this._eventsCount===0?this._events=new i3:delete this._events[s4],this;var a3=this._events[s4];if(a3.fn)a3.fn!==e6||r6&&!a3.once||n5&&a3.context!==n5||(--this._eventsCount===0?this._events=new i3:delete this._events[s4]);else{for(var c4=0,l4=[],h6=a3.length;c4<h6;c4++)(a3[c4].fn!==e6||r6&&!a3[c4].once||n5&&a3[c4].context!==n5)&&l4.push(a3[c4]);l4.length?this._events[s4]=l4.length===1?l4[0]:l4:--this._eventsCount===0?this._events=new i3:delete this._events[s4]}return this},s3.prototype.removeAllListeners=function(t53){var e6;return t53?(e6=o4?o4+t53:t53,this._events[e6]&&(--this._eventsCount===0?this._events=new i3:delete this._events[e6])):(this._events=new i3,this._eventsCount=0),this},s3.prototype.off=s3.prototype.removeListener,s3.prototype.addListener=s3.prototype.on,s3.prototype.setMaxListeners=function(){return this},s3.prefixed=o4,s3.EventEmitter=s3,e5!==void 0&&(e5.exports=s3)}}),g4=s({"node_modules/xml-lexer/dist/lexer.js"(t52,e5){function n4(t53,e6,n5){return e6 in t53?Object.defineProperty(t53,e6,{value:n5,enumerable:!0,configurable:!0,writable:!0}):t53[e6]=n5,t53}var o4=m(),i3=function(){},r5={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},s3={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},a3={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},c4={" ":s3.space," ":s3.space,"\n":s3.space,"\r":s3.space,"<":s3.lt,">":s3.gt,'"':s3.quote,"'":s3.quote,"=":s3.equal,"/":s3.slash};e5.exports={State:r5,Action:s3,Type:a3,create:function(t53){var e6,l4,h6,d4,u5,p4,m4,g6,f3,_4;t53=Object.assign({debug:!1},t53);var y4=new o4,b3=r5.data,x4="",v4="",S3="",I4="",P4="",M4="",N4=function(e7,n5){if(v4[0]!=="?"&&v4[0]!=="!"){var o6={type:e7,value:n5};t53.debug&&console.log("emit:",o6),y4.emit("data",o6)}};y4.stateMachine=(n4(_4={},r5.data,(n4(e6={},s3.lt,function(){x4.trim()&&N4(a3.text,x4),v4="",P4=!1,b3=r5.tagBegin}),n4(e6,s3.char,function(t54){x4+=t54}),e6)),n4(_4,r5.cdata,n4({},s3.char,function(t54){(x4+=t54).substr(-3)==="]]>"&&(N4(a3.text,x4.slice(0,-3)),x4="",b3=r5.data)})),n4(_4,r5.tagBegin,(n4(l4={},s3.space,i3),n4(l4,s3.char,function(t54){v4=t54,b3=r5.tagName}),n4(l4,s3.slash,function(){v4="",P4=!0}),l4)),n4(_4,r5.tagName,(n4(h6={},s3.space,function(){P4?b3=r5.tagEnd:(b3=r5.attributeNameStart,N4(a3.openTag,v4))}),n4(h6,s3.gt,function(){N4(P4?a3.closeTag:a3.openTag,v4),x4="",b3=r5.data}),n4(h6,s3.slash,function(){b3=r5.tagEnd,N4(a3.openTag,v4)}),n4(h6,s3.char,function(t54){(v4+=t54)==="![CDATA["&&(b3=r5.cdata,x4="",v4="")}),h6)),n4(_4,r5.tagEnd,(n4(d4={},s3.gt,function(){N4(a3.closeTag,v4),x4="",b3=r5.data}),n4(d4,s3.char,i3),d4)),n4(_4,r5.attributeNameStart,(n4(u5={},s3.char,function(t54){S3=t54,b3=r5.attributeName}),n4(u5,s3.gt,function(){x4="",b3=r5.data}),n4(u5,s3.space,i3),n4(u5,s3.slash,function(){P4=!0,b3=r5.tagEnd}),u5)),n4(_4,r5.attributeName,(n4(p4={},s3.space,function(){b3=r5.attributeNameEnd}),n4(p4,s3.equal,function(){N4(a3.attributeName,S3),b3=r5.attributeValueBegin}),n4(p4,s3.gt,function(){I4="",N4(a3.attributeName,S3),N4(a3.attributeValue,I4),x4="",b3=r5.data}),n4(p4,s3.slash,function(){P4=!0,I4="",N4(a3.attributeName,S3),N4(a3.attributeValue,I4),b3=r5.tagEnd}),n4(p4,s3.char,function(t54){S3+=t54}),p4)),n4(_4,r5.attributeNameEnd,(n4(m4={},s3.space,i3),n4(m4,s3.equal,function(){N4(a3.attributeName,S3),b3=r5.attributeValueBegin}),n4(m4,s3.gt,function(){I4="",N4(a3.attributeName,S3),N4(a3.attributeValue,I4),x4="",b3=r5.data}),n4(m4,s3.char,function(t54){I4="",N4(a3.attributeName,S3),N4(a3.attributeValue,I4),S3=t54,b3=r5.attributeName}),m4)),n4(_4,r5.attributeValueBegin,(n4(g6={},s3.space,i3),n4(g6,s3.quote,function(t54){M4=t54,I4="",b3=r5.attributeValue}),n4(g6,s3.gt,function(){N4(a3.attributeValue,I4=""),x4="",b3=r5.data}),n4(g6,s3.char,function(t54){M4="",I4=t54,b3=r5.attributeValue}),g6)),n4(_4,r5.attributeValue,(n4(f3={},s3.space,function(t54){M4?I4+=t54:(N4(a3.attributeValue,I4),b3=r5.attributeNameStart)}),n4(f3,s3.quote,function(t54){M4===t54?(N4(a3.attributeValue,I4),b3=r5.attributeNameStart):I4+=t54}),n4(f3,s3.gt,function(t54){M4?I4+=t54:(N4(a3.attributeValue,I4),x4="",b3=r5.data)}),n4(f3,s3.slash,function(t54){M4?I4+=t54:(N4(a3.attributeValue,I4),P4=!0,b3=r5.tagEnd)}),n4(f3,s3.char,function(t54){I4+=t54}),f3)),_4);var C4=function(e7){t53.debug&&console.log(b3,e7);var n5=y4.stateMachine[b3],o6=n5[(function(t54){return c4[t54]||s3.char})(e7)]||n5[s3.error]||n5[s3.char];o6(e7)};return y4.write=function(t54){for(var e7=t54.length,n5=0;n5<e7;n5++)C4(t54[n5])},y4}}}}),f=s({"node_modules/xml-reader/dist/reader.js"(t52,e5){var n4=p(),o4=g4(),i3=o4.Type,r5={element:"element",text:"text"},s3=function(t53){return Object.assign({name:"",type:r5.element,value:"",parent:null,attributes:{},children:[]},t53)},a3=function(t53){t53=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},t53);var e6=void 0,a4=void 0,c4=void 0,l4=void 0,h6=new n4,d4=function(n5){switch(n5.type){case i3.openTag:if(c4===null)(c4=a4).name=n5.value;else{var o6=s3({name:n5.value,parent:c4});c4.children.push(o6),c4=o6}break;case i3.closeTag:var d5=c4.parent;if(t53.parentNodes||(c4.parent=null),c4.name!==n5.value)break;t53.stream&&d5===a4&&(a4.children=[],c4.parent=null),t53.emitTopLevelOnly&&d5!==a4||(h6.emit(t53.tagPrefix+c4.name,c4),h6.emit("tag",c4.name,c4)),c4===a4&&(e6.removeAllListeners("data"),h6.emit(t53.doneEvent,c4),a4=null),c4=d5;break;case i3.text:c4&&c4.children.push(s3({type:r5.text,value:n5.value,parent:t53.parentNodes?c4:null}));break;case i3.attributeName:l4=n5.value,c4.attributes[l4]="";break;case i3.attributeValue:c4.attributes[l4]=n5.value}};return h6.reset=function(){(e6=o4.create({debug:t53.debug})).on("data",d4),a4=s3(),c4=null,l4="",h6.parse=e6.write},h6.reset(),h6};e5.exports={parseSync:function(t53,e6){e6=Object.assign({},e6,{stream:!1,tagPrefix:":"});var n5=a3(e6),o6=void 0;return n5.on("done",function(t54){o6=t54}),n5.parse(t53),o6},create:a3,NodeType:r5}}}),_3=s({"node_modules/binary-search-bounds/search-bounds.js"(t52,e5){function n4(t53,e6,n5,o6,i4){for(var r6=i4+1;o6<=i4;){var s4=o6+i4>>>1,a4=t53[s4];(n5!==void 0?n5(a4,e6):a4-e6)>=0?(r6=s4,i4=s4-1):o6=s4+1}return r6}function o4(t53,e6,n5,o6,i4){for(var r6=i4+1;o6<=i4;){var s4=o6+i4>>>1,a4=t53[s4];(n5!==void 0?n5(a4,e6):a4-e6)>0?(r6=s4,i4=s4-1):o6=s4+1}return r6}function i3(t53,e6,n5,o6,i4){for(var r6=o6-1;o6<=i4;){var s4=o6+i4>>>1,a4=t53[s4];(n5!==void 0?n5(a4,e6):a4-e6)<0?(r6=s4,o6=s4+1):i4=s4-1}return r6}function r5(t53,e6,n5,o6,i4){for(var r6=o6-1;o6<=i4;){var s4=o6+i4>>>1,a4=t53[s4];(n5!==void 0?n5(a4,e6):a4-e6)<=0?(r6=s4,o6=s4+1):i4=s4-1}return r6}function s3(t53,e6,n5,o6,i4){for(;o6<=i4;){var r6=o6+i4>>>1,s4=t53[r6],a4=n5!==void 0?n5(s4,e6):s4-e6;if(a4===0)return r6;a4<=0?o6=r6+1:i4=r6-1}return-1}function a3(t53,e6,n5,o6,i4,r6){return typeof n5=="function"?r6(t53,e6,n5,o6===void 0?0:0|o6,i4===void 0?t53.length-1:0|i4):r6(t53,e6,void 0,n5===void 0?0:0|n5,o6===void 0?t53.length-1:0|o6)}e5.exports={ge:function(t53,e6,o6,i4,r6){return a3(t53,e6,o6,i4,r6,n4)},gt:function(t53,e6,n5,i4,r6){return a3(t53,e6,n5,i4,r6,o4)},lt:function(t53,e6,n5,o6,r6){return a3(t53,e6,n5,o6,r6,i3)},le:function(t53,e6,n5,o6,i4){return a3(t53,e6,n5,o6,i4,r5)},eq:function(t53,e6,n5,o6,i4){return a3(t53,e6,n5,o6,i4,s3)}}}}),y=s({"node_modules/two-product/two-product.js"(t52,e5){e5.exports=function(t53,e6,o4){var i3=t53*e6,r5=n4*t53,s3=r5-(r5-t53),a3=t53-s3,c4=n4*e6,l4=c4-(c4-e6),h6=e6-l4,d4=a3*h6-(i3-s3*l4-a3*l4-s3*h6);return o4?(o4[0]=d4,o4[1]=i3,o4):[d4,i3]};var n4=+(Math.pow(2,27)+1)}}),b=s({"node_modules/robust-sum/robust-sum.js"(t52,e5){e5.exports=function(t53,e6){var n4=0|t53.length,o4=0|e6.length;if(n4===1&&o4===1)return(function(t54,e7){var n5=t54+e7,o6=n5-t54,i4=n5-o6,r6=e7-o6,s4=t54-i4,a4=s4+r6;return a4?[a4,n5]:[n5]})(t53[0],e6[0]);var i3,r5,s3=new Array(n4+o4),a3=0,c4=0,l4=0,h6=Math.abs,d4=t53[c4],u5=h6(d4),p4=e6[l4],m4=h6(p4);u5<m4?(r5=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(r5=p4,(l4+=1)<o4&&(m4=h6(p4=e6[l4]))),c4<n4&&u5<m4||l4>=o4?(i3=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(i3=p4,(l4+=1)<o4&&(m4=h6(p4=e6[l4])));for(var g6,f3,_4=i3+r5,y4=_4-i3,b3=r5-y4,x4=b3,v4=_4;c4<n4&&l4<o4;)u5<m4?(i3=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(i3=p4,(l4+=1)<o4&&(m4=h6(p4=e6[l4]))),(b3=(r5=x4)-(y4=(_4=i3+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6;for(;c4<n4;)(b3=(r5=x4)-(y4=(_4=(i3=d4)+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6,(c4+=1)<n4&&(d4=t53[c4]);for(;l4<o4;)(b3=(r5=x4)-(y4=(_4=(i3=p4)+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6,(l4+=1)<o4&&(p4=e6[l4]);return x4&&(s3[a3++]=x4),v4&&(s3[a3++]=v4),a3||(s3[a3++]=0),s3.length=a3,s3}}}),x3=s({"node_modules/two-sum/two-sum.js"(t52,e5){e5.exports=function(t53,e6,n4){var o4=t53+e6,i3=o4-t53,r5=e6-i3,s3=t53-(o4-i3);return n4?(n4[0]=s3+r5,n4[1]=o4,n4):[s3+r5,o4]}}}),v3=s({"node_modules/robust-scale/robust-scale.js"(t52,e5){var n4=y(),o4=x3();e5.exports=function(t53,e6){var i3=t53.length;if(i3===1){var r5=n4(t53[0],e6);return r5[0]?r5:[r5[1]]}var s3=new Array(2*i3),a3=[.1,.1],c4=[.1,.1],l4=0;n4(t53[0],e6,a3),a3[0]&&(s3[l4++]=a3[0]);for(var h6=1;h6<i3;++h6){n4(t53[h6],e6,c4);var d4=a3[1];o4(d4,c4[0],a3),a3[0]&&(s3[l4++]=a3[0]);var u5=c4[1],p4=a3[1],m4=u5+p4,g6=p4-(m4-u5);a3[1]=m4,g6&&(s3[l4++]=g6)}return a3[1]&&(s3[l4++]=a3[1]),l4===0&&(s3[l4++]=0),s3.length=l4,s3}}}),S2=s({"node_modules/robust-subtract/robust-diff.js"(t52,e5){e5.exports=function(t53,e6){var n4=0|t53.length,o4=0|e6.length;if(n4===1&&o4===1)return(function(t54,e7){var n5=t54+e7,o6=n5-t54,i4=n5-o6,r6=e7-o6,s4=t54-i4,a4=s4+r6;return a4?[a4,n5]:[n5]})(t53[0],-e6[0]);var i3,r5,s3=new Array(n4+o4),a3=0,c4=0,l4=0,h6=Math.abs,d4=t53[c4],u5=h6(d4),p4=-e6[l4],m4=h6(p4);u5<m4?(r5=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(r5=p4,(l4+=1)<o4&&(m4=h6(p4=-e6[l4]))),c4<n4&&u5<m4||l4>=o4?(i3=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(i3=p4,(l4+=1)<o4&&(m4=h6(p4=-e6[l4])));for(var g6,f3,_4=i3+r5,y4=_4-i3,b3=r5-y4,x4=b3,v4=_4;c4<n4&&l4<o4;)u5<m4?(i3=d4,(c4+=1)<n4&&(u5=h6(d4=t53[c4]))):(i3=p4,(l4+=1)<o4&&(m4=h6(p4=-e6[l4]))),(b3=(r5=x4)-(y4=(_4=i3+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6;for(;c4<n4;)(b3=(r5=x4)-(y4=(_4=(i3=d4)+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6,(c4+=1)<n4&&(d4=t53[c4]);for(;l4<o4;)(b3=(r5=x4)-(y4=(_4=(i3=p4)+r5)-i3))&&(s3[a3++]=b3),x4=v4-((g6=v4+_4)-(f3=g6-v4))+(_4-f3),v4=g6,(l4+=1)<o4&&(p4=-e6[l4]);return x4&&(s3[a3++]=x4),v4&&(s3[a3++]=v4),a3||(s3[a3++]=0),s3.length=a3,s3}}}),I3=s({"node_modules/robust-orientation/orientation.js"(t52,e5){var n4=y(),o4=b(),i3=v3(),r5=S2();function s3(t53,e6,n5,o6){return function(n6,i4,r6){var s4=t53(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),t53(e6(n6[1],i4[0]),e6(-i4[1],n6[0]))),a4=t53(e6(n6[1],r6[0]),e6(-r6[1],n6[0])),c5=o6(s4,a4);return c5[c5.length-1]}}function a3(t53,e6,n5,o6){return function(i4,r6,s4,a4){var c5=t53(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),a4[2]))),t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),a4[2])))),l5=t53(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),a4[2]))),t53(n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),s4[2])))),h7=o6(c5,l5);return h7[h7.length-1]}}function c4(t53,e6,n5,o6){return function(i4,r6,s4,a4,c5){var l5=t53(t53(t53(n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),s4[2]),t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),-a4[2]),n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),c5[2]))),r6[3]),t53(n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),r6[2]),t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),-a4[2]),n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),c5[2]))),-s4[3]),n5(t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),c5[2]))),a4[3]))),t53(n5(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),a4[2]))),-c5[3]),t53(n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),r6[2]),t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),-a4[2]),n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),c5[2]))),i4[3]),n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-a4[2]),n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),c5[2]))),-r6[3])))),t53(t53(n5(t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),c5[2]))),a4[3]),t53(n5(t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),a4[2]))),-c5[3]),n5(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),a4[2]))),i4[3]))),t53(n5(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),a4[2]))),-r6[3]),t53(n5(t53(n5(t53(e6(r6[1],a4[0]),e6(-a4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),a4[2]))),s4[3]),n5(t53(n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),s4[2]))),-a4[3]))))),h7=t53(t53(t53(n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),s4[2]),t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),-a4[2]),n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),c5[2]))),i4[3]),n5(t53(n5(t53(e6(a4[1],c5[0]),e6(-c5[1],a4[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-a4[2]),n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),c5[2]))),-s4[3])),t53(n5(t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),c5[2]))),a4[3]),n5(t53(n5(t53(e6(s4[1],a4[0]),e6(-a4[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],a4[0]),e6(-a4[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),a4[2]))),-c5[3]))),t53(t53(n5(t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),r6[2]),t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),-s4[2]),n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),c5[2]))),i4[3]),n5(t53(n5(t53(e6(s4[1],c5[0]),e6(-c5[1],s4[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-s4[2]),n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),c5[2]))),-r6[3])),t53(n5(t53(n5(t53(e6(r6[1],c5[0]),e6(-c5[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],c5[0]),e6(-c5[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),c5[2]))),s4[3]),n5(t53(n5(t53(e6(r6[1],s4[0]),e6(-s4[1],r6[0])),i4[2]),t53(n5(t53(e6(i4[1],s4[0]),e6(-s4[1],i4[0])),-r6[2]),n5(t53(e6(i4[1],r6[0]),e6(-r6[1],i4[0])),s4[2]))),-c5[3])))),d5=o6(l5,h7);return d5[d5.length-1]}}function l4(t53){return(t53===3?s3:t53===4?a3:c4)(o4,n4,i3,r5)}var h6=l4(3),d4=l4(4),u5=[function(){return 0},function(){return 0},function(t53,e6){return e6[0]-t53[0]},function(t53,e6,n5){var o6,i4=(t53[1]-n5[1])*(e6[0]-n5[0]),r6=(t53[0]-n5[0])*(e6[1]-n5[1]),s4=i4-r6;if(i4>0){if(r6<=0)return s4;o6=i4+r6}else{if(!(i4<0)||r6>=0)return s4;o6=-(i4+r6)}var a4=33306690738754716e-32*o6;return s4>=a4||s4<=-a4?s4:h6(t53,e6,n5)},function(t53,e6,n5,o6){var i4=t53[0]-o6[0],r6=e6[0]-o6[0],s4=n5[0]-o6[0],a4=t53[1]-o6[1],c5=e6[1]-o6[1],l5=n5[1]-o6[1],h7=t53[2]-o6[2],u6=e6[2]-o6[2],p5=n5[2]-o6[2],m6=r6*l5,g6=s4*c5,f3=s4*a4,_4=i4*l5,y4=i4*c5,b3=r6*a4,x4=h7*(m6-g6)+u6*(f3-_4)+p5*(y4-b3),v4=7771561172376103e-31*((Math.abs(m6)+Math.abs(g6))*Math.abs(h7)+(Math.abs(f3)+Math.abs(_4))*Math.abs(u6)+(Math.abs(y4)+Math.abs(b3))*Math.abs(p5));return x4>v4||-x4>v4?x4:d4(t53,e6,n5,o6)}];function p4(t53){var e6=u5[t53.length];return e6||(e6=u5[t53.length]=l4(t53.length)),e6.apply(void 0,t53)}function m4(t53,e6,n5,o6,i4,r6,s4){return function(e7,n6,a4,c5,l5){switch(arguments.length){case 0:case 1:return 0;case 2:return o6(e7,n6);case 3:return i4(e7,n6,a4);case 4:return r6(e7,n6,a4,c5);case 5:return s4(e7,n6,a4,c5,l5)}for(var h7=new Array(arguments.length),d5=0;d5<arguments.length;++d5)h7[d5]=arguments[d5];return t53(h7)}}(function(){for(;u5.length<=5;)u5.push(l4(u5.length));e5.exports=m4.apply(void 0,[p4].concat(u5));for(var t53=0;t53<=5;++t53)e5.exports[t53]=u5[t53]})()}}),P2=s({"node_modules/cdt2d/lib/monotone.js"(t52,e5){var n4=_3(),o4=I3()[3];function i3(t53,e6,n5,o6,i4){this.a=t53,this.b=e6,this.idx=n5,this.lowerIds=o6,this.upperIds=i4}function r5(t53,e6,n5,o6){this.a=t53,this.b=e6,this.type=n5,this.idx=o6}function s3(t53,e6){var n5=t53.a[0]-e6.a[0]||t53.a[1]-e6.a[1]||t53.type-e6.type;return n5||(t53.type!==0&&(n5=o4(t53.a,t53.b,e6.b))?n5:t53.idx-e6.idx)}function a3(t53,e6){return o4(t53.a,t53.b,e6)}function c4(t53,e6,i4,r6,s4){for(var c5=n4.lt(e6,r6,a3),l5=n4.gt(e6,r6,a3),h7=c5;h7<l5;++h7){for(var d5=e6[h7],u5=d5.lowerIds,p4=u5.length;p4>1&&o4(i4[u5[p4-2]],i4[u5[p4-1]],r6)>0;)t53.push([u5[p4-1],u5[p4-2],s4]),p4-=1;u5.length=p4,u5.push(s4);var m4=d5.upperIds;for(p4=m4.length;p4>1&&o4(i4[m4[p4-2]],i4[m4[p4-1]],r6)<0;)t53.push([m4[p4-2],m4[p4-1],s4]),p4-=1;m4.length=p4,m4.push(s4)}}function l4(t53,e6){var n5;return(n5=t53.a[0]<e6.a[0]?o4(t53.a,t53.b,e6.a):o4(e6.b,e6.a,t53.a))?n5:(n5=e6.b[0]<t53.b[0]?o4(t53.a,t53.b,e6.b):o4(e6.b,e6.a,t53.b))||t53.idx-e6.idx}function h6(t53,e6,o6){var r6=n4.le(t53,o6,l4),s4=t53[r6],a4=s4.upperIds,c5=a4[a4.length-1];s4.upperIds=[c5],t53.splice(r6+1,0,new i3(o6.a,o6.b,o6.idx,[c5],a4))}function d4(t53,e6,o6){var i4=o6.a;o6.a=o6.b,o6.b=i4;var r6=n4.eq(t53,o6,l4),s4=t53[r6];t53[r6-1].upperIds=s4.upperIds,t53.splice(r6,1)}e5.exports=function(t53,e6){for(var n5=t53.length,o6=e6.length,a4=[],l5=0;l5<n5;++l5)a4.push(new r5(t53[l5],null,0,l5));for(l5=0;l5<o6;++l5){var u5=e6[l5],p4=t53[u5[0]],m4=t53[u5[1]];p4[0]<m4[0]?a4.push(new r5(p4,m4,2,l5),new r5(m4,p4,1,l5)):p4[0]>m4[0]&&a4.push(new r5(m4,p4,2,l5),new r5(p4,m4,1,l5))}a4.sort(s3);for(var g6=a4[0].a[0]-(1+Math.abs(a4[0].a[0]))*Math.pow(2,-52),f3=[new i3([g6,1],[g6,0],-1,[],[],[],[])],_4=[],y4=(l5=0,a4.length);l5<y4;++l5){var b3=a4[l5],x4=b3.type;x4===0?c4(_4,f3,t53,b3.a,b3.idx):x4===2?h6(f3,t53,b3):d4(f3,t53,b3)}return _4}}}),M3=s({"node_modules/cdt2d/lib/triangulation.js"(t52,e5){var n4=_3();function o4(t53,e6){this.stars=t53,this.edges=e6}e5.exports=function(t53,e6){for(var n5=new Array(t53),i4=0;i4<t53;++i4)n5[i4]=[];return new o4(n5,e6)};var i3=o4.prototype;function r5(t53,e6,n5){for(var o6=1,i4=t53.length;o6<i4;o6+=2)if(t53[o6-1]===e6&&t53[o6]===n5)return t53[o6-1]=t53[i4-2],t53[o6]=t53[i4-1],void(t53.length=i4-2)}i3.isConstraint=(function(){var t53=[0,0];function e6(t54,e7){return t54[0]-e7[0]||t54[1]-e7[1]}return function(o6,i4){return t53[0]=Math.min(o6,i4),t53[1]=Math.max(o6,i4),n4.eq(this.edges,t53,e6)>=0}})(),i3.removeTriangle=function(t53,e6,n5){var o6=this.stars;r5(o6[t53],e6,n5),r5(o6[e6],n5,t53),r5(o6[n5],t53,e6)},i3.addTriangle=function(t53,e6,n5){var o6=this.stars;o6[t53].push(e6,n5),o6[e6].push(n5,t53),o6[n5].push(t53,e6)},i3.opposite=function(t53,e6){for(var n5=this.stars[e6],o6=1,i4=n5.length;o6<i4;o6+=2)if(n5[o6]===t53)return n5[o6-1];return-1},i3.flip=function(t53,e6){var n5=this.opposite(t53,e6),o6=this.opposite(e6,t53);this.removeTriangle(t53,e6,n5),this.removeTriangle(e6,t53,o6),this.addTriangle(t53,o6,n5),this.addTriangle(e6,n5,o6)},i3.edges=function(){for(var t53=this.stars,e6=[],n5=0,o6=t53.length;n5<o6;++n5)for(var i4=t53[n5],r6=0,s3=i4.length;r6<s3;r6+=2)e6.push([i4[r6],i4[r6+1]]);return e6},i3.cells=function(){for(var t53=this.stars,e6=[],n5=0,o6=t53.length;n5<o6;++n5)for(var i4=t53[n5],r6=0,s3=i4.length;r6<s3;r6+=2){var a3=i4[r6],c4=i4[r6+1];n5<Math.min(a3,c4)&&e6.push([n5,a3,c4])}return e6}}}),N3=s({"node_modules/robust-in-sphere/in-sphere.js"(t52,e5){var n4=y(),o4=b(),i3=S2(),r5=v3();function s3(t53){return(t53===3?a3:t53===4?c4:t53===5?l4:h6)(o4,i3,n4,r5)}function a3(t53,e6,n5,o6){return function(i4,r6,s4){var a4=n5(i4[0],i4[0]),c5=o6(a4,r6[0]),l5=o6(a4,s4[0]),h7=n5(r6[0],r6[0]),d5=o6(h7,i4[0]),u6=o6(h7,s4[0]),p5=n5(s4[0],s4[0]),m4=o6(p5,i4[0]),g6=o6(p5,r6[0]),f3=t53(e6(g6,u6),e6(d5,c5)),_4=e6(m4,l5),y4=e6(f3,_4);return y4[y4.length-1]}}function c4(t53,e6,n5,o6){return function(i4,r6,s4,a4){var c5=t53(n5(i4[0],i4[0]),n5(i4[1],i4[1])),l5=o6(c5,r6[0]),h7=o6(c5,s4[0]),d5=o6(c5,a4[0]),u6=t53(n5(r6[0],r6[0]),n5(r6[1],r6[1])),p5=o6(u6,i4[0]),m4=o6(u6,s4[0]),g6=o6(u6,a4[0]),f3=t53(n5(s4[0],s4[0]),n5(s4[1],s4[1])),_4=o6(f3,i4[0]),y4=o6(f3,r6[0]),b3=o6(f3,a4[0]),x4=t53(n5(a4[0],a4[0]),n5(a4[1],a4[1])),v4=o6(x4,i4[0]),S3=o6(x4,r6[0]),I4=o6(x4,s4[0]),P4=t53(t53(o6(e6(I4,b3),r6[1]),t53(o6(e6(S3,g6),-s4[1]),o6(e6(y4,m4),a4[1]))),t53(o6(e6(S3,g6),i4[1]),t53(o6(e6(v4,d5),-r6[1]),o6(e6(p5,l5),a4[1])))),M4=t53(t53(o6(e6(I4,b3),i4[1]),t53(o6(e6(v4,d5),-s4[1]),o6(e6(_4,h7),a4[1]))),t53(o6(e6(y4,m4),i4[1]),t53(o6(e6(_4,h7),-r6[1]),o6(e6(p5,l5),s4[1])))),N4=e6(P4,M4);return N4[N4.length-1]}}function l4(t53,e6,n5,o6){return function(i4,r6,s4,a4,c5){var l5=t53(n5(i4[0],i4[0]),t53(n5(i4[1],i4[1]),n5(i4[2],i4[2]))),h7=o6(l5,r6[0]),d5=o6(l5,s4[0]),u6=o6(l5,a4[0]),p5=o6(l5,c5[0]),m4=t53(n5(r6[0],r6[0]),t53(n5(r6[1],r6[1]),n5(r6[2],r6[2]))),g6=o6(m4,i4[0]),f3=o6(m4,s4[0]),_4=o6(m4,a4[0]),y4=o6(m4,c5[0]),b3=t53(n5(s4[0],s4[0]),t53(n5(s4[1],s4[1]),n5(s4[2],s4[2]))),x4=o6(b3,i4[0]),v4=o6(b3,r6[0]),S3=o6(b3,a4[0]),I4=o6(b3,c5[0]),P4=t53(n5(a4[0],a4[0]),t53(n5(a4[1],a4[1]),n5(a4[2],a4[2]))),M4=o6(P4,i4[0]),N4=o6(P4,r6[0]),C4=o6(P4,s4[0]),T4=o6(P4,c5[0]),w4=t53(n5(c5[0],c5[0]),t53(n5(c5[1],c5[1]),n5(c5[2],c5[2]))),R3=o6(w4,i4[0]),E3=o6(w4,r6[0]),A4=o6(w4,s4[0]),O3=o6(w4,a4[0]),L3=t53(t53(t53(o6(t53(o6(e6(O3,T4),s4[1]),t53(o6(e6(A4,I4),-a4[1]),o6(e6(C4,S3),c5[1]))),r6[2]),t53(o6(t53(o6(e6(O3,T4),r6[1]),t53(o6(e6(E3,y4),-a4[1]),o6(e6(N4,_4),c5[1]))),-s4[2]),o6(t53(o6(e6(A4,I4),r6[1]),t53(o6(e6(E3,y4),-s4[1]),o6(e6(v4,f3),c5[1]))),a4[2]))),t53(o6(t53(o6(e6(C4,S3),r6[1]),t53(o6(e6(N4,_4),-s4[1]),o6(e6(v4,f3),a4[1]))),-c5[2]),t53(o6(t53(o6(e6(O3,T4),r6[1]),t53(o6(e6(E3,y4),-a4[1]),o6(e6(N4,_4),c5[1]))),i4[2]),o6(t53(o6(e6(O3,T4),i4[1]),t53(o6(e6(R3,p5),-a4[1]),o6(e6(M4,u6),c5[1]))),-r6[2])))),t53(t53(o6(t53(o6(e6(E3,y4),i4[1]),t53(o6(e6(R3,p5),-r6[1]),o6(e6(g6,h7),c5[1]))),a4[2]),t53(o6(t53(o6(e6(N4,_4),i4[1]),t53(o6(e6(M4,u6),-r6[1]),o6(e6(g6,h7),a4[1]))),-c5[2]),o6(t53(o6(e6(C4,S3),r6[1]),t53(o6(e6(N4,_4),-s4[1]),o6(e6(v4,f3),a4[1]))),i4[2]))),t53(o6(t53(o6(e6(C4,S3),i4[1]),t53(o6(e6(M4,u6),-s4[1]),o6(e6(x4,d5),a4[1]))),-r6[2]),t53(o6(t53(o6(e6(N4,_4),i4[1]),t53(o6(e6(M4,u6),-r6[1]),o6(e6(g6,h7),a4[1]))),s4[2]),o6(t53(o6(e6(v4,f3),i4[1]),t53(o6(e6(x4,d5),-r6[1]),o6(e6(g6,h7),s4[1]))),-a4[2]))))),D4=t53(t53(t53(o6(t53(o6(e6(O3,T4),s4[1]),t53(o6(e6(A4,I4),-a4[1]),o6(e6(C4,S3),c5[1]))),i4[2]),o6(t53(o6(e6(O3,T4),i4[1]),t53(o6(e6(R3,p5),-a4[1]),o6(e6(M4,u6),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(A4,I4),i4[1]),t53(o6(e6(R3,p5),-s4[1]),o6(e6(x4,d5),c5[1]))),a4[2]),o6(t53(o6(e6(C4,S3),i4[1]),t53(o6(e6(M4,u6),-s4[1]),o6(e6(x4,d5),a4[1]))),-c5[2]))),t53(t53(o6(t53(o6(e6(A4,I4),r6[1]),t53(o6(e6(E3,y4),-s4[1]),o6(e6(v4,f3),c5[1]))),i4[2]),o6(t53(o6(e6(A4,I4),i4[1]),t53(o6(e6(R3,p5),-s4[1]),o6(e6(x4,d5),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(E3,y4),i4[1]),t53(o6(e6(R3,p5),-r6[1]),o6(e6(g6,h7),c5[1]))),s4[2]),o6(t53(o6(e6(v4,f3),i4[1]),t53(o6(e6(x4,d5),-r6[1]),o6(e6(g6,h7),s4[1]))),-c5[2])))),k4=e6(L3,D4);return k4[k4.length-1]}}function h6(t53,e6,n5,o6){return function(i4,r6,s4,a4,c5,l5){var h7=t53(t53(n5(i4[0],i4[0]),n5(i4[1],i4[1])),t53(n5(i4[2],i4[2]),n5(i4[3],i4[3]))),d5=o6(h7,r6[0]),u6=o6(h7,s4[0]),p5=o6(h7,a4[0]),m4=o6(h7,c5[0]),g6=o6(h7,l5[0]),f3=t53(t53(n5(r6[0],r6[0]),n5(r6[1],r6[1])),t53(n5(r6[2],r6[2]),n5(r6[3],r6[3]))),_4=o6(f3,i4[0]),y4=o6(f3,s4[0]),b3=o6(f3,a4[0]),x4=o6(f3,c5[0]),v4=o6(f3,l5[0]),S3=t53(t53(n5(s4[0],s4[0]),n5(s4[1],s4[1])),t53(n5(s4[2],s4[2]),n5(s4[3],s4[3]))),I4=o6(S3,i4[0]),P4=o6(S3,r6[0]),M4=o6(S3,a4[0]),N4=o6(S3,c5[0]),C4=o6(S3,l5[0]),T4=t53(t53(n5(a4[0],a4[0]),n5(a4[1],a4[1])),t53(n5(a4[2],a4[2]),n5(a4[3],a4[3]))),w4=o6(T4,i4[0]),R3=o6(T4,r6[0]),E3=o6(T4,s4[0]),A4=o6(T4,c5[0]),O3=o6(T4,l5[0]),L3=t53(t53(n5(c5[0],c5[0]),n5(c5[1],c5[1])),t53(n5(c5[2],c5[2]),n5(c5[3],c5[3]))),D4=o6(L3,i4[0]),k4=o6(L3,r6[0]),z4=o6(L3,s4[0]),j4=o6(L3,a4[0]),F4=o6(L3,l5[0]),$5=t53(t53(n5(l5[0],l5[0]),n5(l5[1],l5[1])),t53(n5(l5[2],l5[2]),n5(l5[3],l5[3]))),B4=o6($5,i4[0]),Y4=o6($5,r6[0]),X4=o6($5,s4[0]),H4=o6($5,a4[0]),W5=o6($5,c5[0]),V4=t53(t53(t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),s4[2]),o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),-l5[2]))),r6[3]),t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),r6[2]),o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),-l5[2]))),-s4[3]),o6(t53(t53(o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),r6[2]),o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),c5[2]),o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),-l5[2]))),a4[3]))),t53(t53(o6(t53(t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),r6[2]),o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),-l5[2]))),-c5[3]),o6(t53(t53(o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),r6[2]),o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),-c5[2]))),l5[3])),t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),r6[2]),o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),-l5[2]))),i4[3]),o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-l5[2]))),-r6[3])))),t53(t53(t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),c5[2]),o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),-l5[2]))),a4[3]),o6(t53(t53(o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),i4[2]),o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),a4[2]),o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),-l5[2]))),-c5[3])),t53(o6(t53(t53(o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),i4[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),a4[2]),o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),-c5[2]))),l5[3]),o6(t53(t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),r6[2]),o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),-l5[2]))),i4[3]))),t53(t53(o6(t53(t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),i4[2]),o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-l5[2]))),-r6[3]),o6(t53(t53(o6(t53(o6(e6(H4,O3),r6[1]),t53(o6(e6(Y4,v4),-a4[1]),o6(e6(R3,b3),l5[1]))),i4[2]),o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),a4[2]),o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),-l5[2]))),s4[3])),t53(o6(t53(t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),i4[2]),o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-l5[2]))),-a4[3]),o6(t53(t53(o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),i4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-r6[2])),t53(o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-a4[2]))),l5[3]))))),U3=t53(t53(t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),s4[2]),o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),-l5[2]))),i4[3]),t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),a4[1]),t53(o6(e6(H4,O3),-c5[1]),o6(e6(j4,A4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-a4[2])),t53(o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),c5[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-l5[2]))),-s4[3]),o6(t53(t53(o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),c5[2]),o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),-l5[2]))),a4[3]))),t53(t53(o6(t53(t53(o6(t53(o6(e6(H4,O3),s4[1]),t53(o6(e6(X4,C4),-a4[1]),o6(e6(E3,M4),l5[1]))),i4[2]),o6(t53(o6(e6(H4,O3),i4[1]),t53(o6(e6(B4,g6),-a4[1]),o6(e6(w4,p5),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-l5[2]))),-c5[3]),o6(t53(t53(o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),i4[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-c5[2]))),l5[3])),t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),r6[2]),o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),c5[2]),o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),-l5[2]))),i4[3]),o6(t53(t53(o6(t53(o6(e6(W5,F4),s4[1]),t53(o6(e6(X4,C4),-c5[1]),o6(e6(z4,N4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-s4[2])),t53(o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),c5[2]),o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),-l5[2]))),-r6[3])))),t53(t53(t53(o6(t53(t53(o6(t53(o6(e6(W5,F4),r6[1]),t53(o6(e6(Y4,v4),-c5[1]),o6(e6(k4,x4),l5[1]))),i4[2]),o6(t53(o6(e6(W5,F4),i4[1]),t53(o6(e6(B4,g6),-c5[1]),o6(e6(D4,m4),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),c5[2]),o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),-l5[2]))),s4[3]),o6(t53(t53(o6(t53(o6(e6(X4,C4),r6[1]),t53(o6(e6(Y4,v4),-s4[1]),o6(e6(P4,y4),l5[1]))),i4[2]),o6(t53(o6(e6(X4,C4),i4[1]),t53(o6(e6(B4,g6),-s4[1]),o6(e6(I4,u6),l5[1]))),-r6[2])),t53(o6(t53(o6(e6(Y4,v4),i4[1]),t53(o6(e6(B4,g6),-r6[1]),o6(e6(_4,d5),l5[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-l5[2]))),-c5[3])),t53(o6(t53(t53(o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),i4[2]),o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-c5[2]))),l5[3]),o6(t53(t53(o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),r6[2]),o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),-c5[2]))),i4[3]))),t53(t53(o6(t53(t53(o6(t53(o6(e6(j4,A4),s4[1]),t53(o6(e6(z4,N4),-a4[1]),o6(e6(E3,M4),c5[1]))),i4[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-s4[2])),t53(o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),a4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-c5[2]))),-r6[3]),o6(t53(t53(o6(t53(o6(e6(j4,A4),r6[1]),t53(o6(e6(k4,x4),-a4[1]),o6(e6(R3,b3),c5[1]))),i4[2]),o6(t53(o6(e6(j4,A4),i4[1]),t53(o6(e6(D4,m4),-a4[1]),o6(e6(w4,p5),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),a4[2]),o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),-c5[2]))),s4[3])),t53(o6(t53(t53(o6(t53(o6(e6(z4,N4),r6[1]),t53(o6(e6(k4,x4),-s4[1]),o6(e6(P4,y4),c5[1]))),i4[2]),o6(t53(o6(e6(z4,N4),i4[1]),t53(o6(e6(D4,m4),-s4[1]),o6(e6(I4,u6),c5[1]))),-r6[2])),t53(o6(t53(o6(e6(k4,x4),i4[1]),t53(o6(e6(D4,m4),-r6[1]),o6(e6(_4,d5),c5[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-c5[2]))),-a4[3]),o6(t53(t53(o6(t53(o6(e6(E3,M4),r6[1]),t53(o6(e6(R3,b3),-s4[1]),o6(e6(P4,y4),a4[1]))),i4[2]),o6(t53(o6(e6(E3,M4),i4[1]),t53(o6(e6(w4,p5),-s4[1]),o6(e6(I4,u6),a4[1]))),-r6[2])),t53(o6(t53(o6(e6(R3,b3),i4[1]),t53(o6(e6(w4,p5),-r6[1]),o6(e6(_4,d5),a4[1]))),s4[2]),o6(t53(o6(e6(P4,y4),i4[1]),t53(o6(e6(I4,u6),-r6[1]),o6(e6(_4,d5),s4[1]))),-a4[2]))),c5[3]))))),Z3=e6(V4,U3);return Z3[Z3.length-1]}}var d4=[function(){return 0},function(){return 0},function(){return 0}];function u5(t53){var e6=d4[t53.length];return e6||(e6=d4[t53.length]=s3(t53.length)),e6.apply(void 0,t53)}function p4(t53,e6,n5,o6,i4,r6,s4,a4){return function(e7,n6,c5,l5,h7,d5){switch(arguments.length){case 0:case 1:return 0;case 2:return o6(e7,n6);case 3:return i4(e7,n6,c5);case 4:return r6(e7,n6,c5,l5);case 5:return s4(e7,n6,c5,l5,h7);case 6:return a4(e7,n6,c5,l5,h7,d5)}for(var u6=new Array(arguments.length),p5=0;p5<arguments.length;++p5)u6[p5]=arguments[p5];return t53(u6)}}(function(){for(;d4.length<=6;)d4.push(s3(d4.length));e5.exports=p4.apply(void 0,[u5].concat(d4));for(var t53=0;t53<=6;++t53)e5.exports[t53]=d4[t53]})()}}),C3=s({"node_modules/cdt2d/lib/delaunay.js"(t52,e5){var n4=N3()[4];_3();function o4(t53,e6,o6,i3,r5,s3){var a3=e6.opposite(i3,r5);if(!(a3<0)){if(r5<i3){var c4=i3;i3=r5,r5=c4,c4=s3,s3=a3,a3=c4}e6.isConstraint(i3,r5)||n4(t53[i3],t53[r5],t53[s3],t53[a3])<0&&o6.push(i3,r5)}}e5.exports=function(t53,e6){for(var i3=[],r5=t53.length,s3=e6.stars,a3=0;a3<r5;++a3)for(var c4=s3[a3],l4=1;l4<c4.length;l4+=2)if(!((p4=c4[l4])<a3)&&!e6.isConstraint(a3,p4)){for(var h6=c4[l4-1],d4=-1,u5=1;u5<c4.length;u5+=2)if(c4[u5-1]===p4){d4=c4[u5];break}d4<0||n4(t53[a3],t53[p4],t53[h6],t53[d4])<0&&i3.push(a3,p4)}for(;i3.length>0;){for(var p4=i3.pop(),m4=(h6=-1,d4=-1,c4=s3[a3=i3.pop()],1);m4<c4.length;m4+=2){var g6=c4[m4-1],f3=c4[m4];g6===p4?d4=f3:f3===p4&&(h6=g6)}h6<0||d4<0||n4(t53[a3],t53[p4],t53[h6],t53[d4])>=0||(e6.flip(a3,p4),o4(t53,e6,i3,h6,a3,d4),o4(t53,e6,i3,a3,d4,h6),o4(t53,e6,i3,d4,p4,h6),o4(t53,e6,i3,p4,h6,d4))}}}}),T3=s({"node_modules/cdt2d/lib/filter.js"(t52,e5){var n4=_3();function o4(t53,e6,n5,o6,i4,r5,s3){this.cells=t53,this.neighbor=e6,this.flags=o6,this.constraint=n5,this.active=i4,this.next=r5,this.boundary=s3}function i3(t53,e6){return t53[0]-e6[0]||t53[1]-e6[1]||t53[2]-e6[2]}e5.exports=function(t53,e6,n5){var r5=(function(t54,e7){for(var n6=t54.cells(),r6=n6.length,s4=0;s4<r6;++s4){var a4=(_5=n6[s4])[0],c5=_5[1],l5=_5[2];c5<l5?c5<a4&&(_5[0]=c5,_5[1]=l5,_5[2]=a4):l5<a4&&(_5[0]=l5,_5[1]=a4,_5[2]=c5)}n6.sort(i3);var h7=new Array(r6);for(s4=0;s4<h7.length;++s4)h7[s4]=0;var d5=[],u6=[],p5=new Array(3*r6),m6=new Array(3*r6),g7=null;e7&&(g7=[]);var f4=new o4(n6,p5,m6,h7,d5,u6,g7);for(s4=0;s4<r6;++s4)for(var _5=n6[s4],y4=0;y4<3;++y4){a4=_5[y4],c5=_5[(y4+1)%3];var b3=p5[3*s4+y4]=f4.locate(c5,a4,t54.opposite(c5,a4)),x4=m6[3*s4+y4]=t54.isConstraint(a4,c5);b3<0&&(x4?u6.push(s4):(d5.push(s4),h7[s4]=1),e7&&g7.push([c5,a4,-1]))}return f4})(t53,n5);if(e6===0)return n5?r5.cells.concat(r5.boundary):r5.cells;for(var s3=1,a3=r5.active,c4=r5.next,l4=r5.flags,h6=r5.cells,d4=r5.constraint,u5=r5.neighbor;a3.length>0||c4.length>0;){for(;a3.length>0;){var p4=a3.pop();if(l4[p4]!==-s3){l4[p4]=s3,h6[p4];for(var m4=0;m4<3;++m4){var g6=u5[3*p4+m4];g6>=0&&l4[g6]===0&&(d4[3*p4+m4]?c4.push(g6):(a3.push(g6),l4[g6]=s3))}}}var f3=c4;c4=a3,a3=f3,c4.length=0,s3=-s3}var _4=(function(t54,e7,n6){for(var o6=0,i4=0;i4<t54.length;++i4)e7[i4]===n6&&(t54[o6++]=t54[i4]);return t54.length=o6,t54})(h6,l4,e6);return n5?_4.concat(r5.boundary):_4},o4.prototype.locate=(function(){var t53=[0,0,0];return function(e6,o6,r5){var s3=e6,a3=o6,c4=r5;return o6<r5?o6<e6&&(s3=o6,a3=r5,c4=e6):r5<e6&&(s3=r5,a3=e6,c4=o6),s3<0?-1:(t53[0]=s3,t53[1]=a3,t53[2]=c4,n4.eq(this.cells,t53,i3))}})()}}),w3=s({"node_modules/cdt2d/cdt2d.js"(t52,e5){var n4=P2(),o4=M3(),i3=C3(),r5=T3();function s3(t53){return[Math.min(t53[0],t53[1]),Math.max(t53[0],t53[1])]}function a3(t53,e6){return t53[0]-e6[0]||t53[1]-e6[1]}function c4(t53,e6,n5){return e6 in t53?t53[e6]:n5}e5.exports=function(t53,e6,l4){Array.isArray(e6)?(l4=l4||{},e6=e6||[]):(l4=e6||{},e6=[]);var h6=!!c4(l4,"delaunay",!0),d4=!!c4(l4,"interior",!0),u5=!!c4(l4,"exterior",!0),p4=!!c4(l4,"infinity",!1);if(!d4&&!u5||t53.length===0)return[];var m4=n4(t53,e6);if(h6||d4!==u5||p4){for(var g6=o4(t53.length,(function(t54){return t54.map(s3).sort(a3)})(e6)),f3=0;f3<m4.length;++f3){var _4=m4[f3];g6.addTriangle(_4[0],_4[1],_4[2])}return h6&&i3(t53,g6),u5?d4?p4?r5(g6,0,p4):g6.cells():r5(g6,1,p4):r5(g6,-1)}return m4}}}),R2={0:"M0.301025 0.257813 L0.206593 0.283385 L0.122042 0.361307 L0.075923 0.474441 L0.064942 0.642221 L0.091296 0.78289 L0.159376 0.899463 L0.257104 0.961214 L0.344948 0.961214 L0.442678 0.899463 L0.510757 0.78289 L0.537111 0.642221 L0.526131 0.474441 L0.480012 0.361307 L0.39546 0.283385 L0.301025 0.257813",1:"M0.220426 0.40845 L0.381626 0.270996 L0.381626 0.948966",2:"M0.110409 0.39212 L0.125621 0.342293 L0.170571 0.295823 L0.244237 0.26431 L0.291518 0.257813 L0.373319 0.263799 L0.434683 0.290705 L0.468239 0.331966 L0.480292 0.379913 L0.479492 0.411806 L0.465088 0.465192 L0.402571 0.568988 L0.245134 0.766438 L0.07959 0.948045 L0.522462 0.948045",3:"M0.081606 0.345073 L0.119154 0.315633 L0.178996 0.284091 L0.255265 0.257813 L0.349133 0.263062 L0.43127 0.289348 L0.48994 0.336662 L0.525141 0.394491 L0.513407 0.457577 L0.466472 0.504892 L0.384334 0.541692 L0.290464 0.56272 L0.20833 0.573235 L0.290464 0.583749 L0.384334 0.610035 L0.466472 0.652092 L0.519274 0.709922 L0.531007 0.773007 L0.50754 0.841351 L0.454738 0.899179 L0.3726 0.946494 L0.310412 0.961214 L0.209503 0.959111 L0.127367 0.946494 L0.071046 0.929671",4:"M0.418494 0.270996 L0.048828 0.724199 L0.553224 0.724199 M0.414181 0.578167 L0.414181 0.94897",5:"M0.074951 0.270996 L0.074951 0.614701 L0.267655 0.5695 L0.405247 0.586502 L0.460002 0.617189 L0.498028 0.660731 L0.527101 0.779401 L0.513352 0.841049 L0.477274 0.889568 L0.406378 0.93463 L0.324445 0.958337 L0.247399 0.962139 L0.182516 0.949767 L0.130068 0.925508 L0.074951 0.875607 M0.074951 0.270996 L0.527101 0.270996",6:"M0.428549 0.257813 L0.341433 0.285053 L0.26073 0.312099 L0.192188 0.360182 L0.138902 0.410969 L0.098219 0.500422 L0.070249 0.584267 L0.067264 0.670716 L0.065164 0.756863 L0.087163 0.820973 L0.108168 0.861042 L0.157916 0.913131 L0.210981 0.948192 L0.29279 0.961214 L0.384548 0.956206 L0.456409 0.924151 L0.507262 0.881077 L0.5349 0.821975 L0.537111 0.771889 L0.521634 0.718798 L0.498418 0.67372 L0.463042 0.636657 L0.414398 0.613617 L0.34696 0.598591 L0.28284 0.595587 L0.215403 0.605604 L0.145756 0.641665 L0.109274 0.678729 L0.064942 0.724006",7:"M0.071534 0.270996 L0.530519 0.270996 L0.495935 0.291702 L0.477752 0.305407 L0.435186 0.346112 L0.412067 0.374136 L0.388565 0.40796 L0.365315 0.448098 L0.342943 0.495062 L0.322081 0.549366 L0.303364 0.611524 L0.287416 0.68205 L0.270077 0.80465 L0.26253 0.94897",8:"M0.286761 0.257813 L0.210684 0.27162 L0.1414 0.305622 L0.092494 0.382125 L0.111513 0.450128 L0.16857 0.502193 L0.228345 0.539382 L0.377781 0.594635 L0.470161 0.645637 L0.52586 0.706203 L0.538087 0.792269 L0.506841 0.87621 L0.438915 0.927212 L0.339743 0.961214 L0.263666 0.959089 L0.174004 0.929337 L0.102003 0.881523 L0.063965 0.811395 L0.066682 0.741266 L0.102003 0.671139 L0.180797 0.608448 L0.259591 0.580822 L0.358762 0.548945 L0.456576 0.49688 L0.486463 0.446941 L0.487822 0.362999 L0.453859 0.302434 L0.384574 0.265245 L0.286761 0.257813",9:"M0.511026 0.437812 L0.491026 0.347812 L0.451026 0.297812 L0.391026 0.267812 L0.311026 0.257813 L0.231026 0.267812 L0.161026 0.297812 L0.111026 0.347812 L0.091026 0.417812 L0.111026 0.487812 L0.161026 0.537812 L0.231026 0.567812 L0.311026 0.577812 L0.391026 0.557812 L0.451026 0.517812 L0.491026 0.477812 L0.511026 0.437812 M0.510026 0.438812 L0.434026 0.636812 L0.381026 0.777812 L0.337026 0.879812 L0.301026 0.957812","!":"M0.301026 0.270996 L0.301026 0.749566 M0.251466 0.94897 L0.350587 0.94897",'"':"M0.16504 0.270996 L0.16504 0.523022 M0.437013 0.270996 L0.437013 0.523022","#":"M0.20958 0.282227 L0.146515 0.949754 M0.461844 0.282227 L0.398779 0.949754 M0.032999 0.526969 L0.600587 0.452796 M0.001465 0.82366 L0.569055 0.749486",$:"M0.307121 0.240234 L0.307121 1.083502 M0.490031 0.415915 L0.404676 0.328075 L0.23396 0.310507 L0.136407 0.398347 L0.099828 0.521324 L0.124213 0.591596 L0.197379 0.644299 L0.429061 0.697003 L0.502224 0.749708 L0.526613 0.837547 L0.477836 0.960526 L0.355897 1.013228 L0.197379 0.99566 L0.112021 0.942957 L0.07544 0.837547","'":"M0.301026 0.270996 L0.301026 0.523022","(":"M0.413087 0.241211 L0.372337 0.28347 L0.331589 0.334184 L0.290838 0.393349 L0.25009 0.460965 L0.219528 0.528584 L0.199153 0.5962 L0.188966 0.655364 L0.199153 0.714529 L0.219528 0.782146 L0.25009 0.849764 L0.290838 0.91738 L0.331589 0.976544 L0.372337 1.027258 L0.413087 1.069491",")":"M0.188966 0.241211 L0.229716 0.28347 L0.270466 0.334184 L0.311213 0.393349 L0.351964 0.460965 L0.382526 0.528584 L0.4029 0.5962 L0.413087 0.655364 L0.4029 0.714529 L0.382526 0.782146 L0.351964 0.849764 L0.311213 0.91738 L0.270466 0.976544 L0.229716 1.027258 L0.188966 1.069491","*":"M0.301026 0.458702 L0.301026 0.681942 M0.301026 0.458702 L0.520997 0.536834 M0.301026 0.458702 L0.439954 0.257813 M0.301026 0.458702 L0.162098 0.257813 M0.301026 0.458702 L0.081055 0.536834","+":"M0.042969 0.66845 L0.559083 0.66845 M0.301023 0.428223 L0.301023 0.908661",",":"M0.38672 0.852051 L0.215333 1.030661 L0.301025 1.119971","-":"M0.173829 0.686035 L0.428224 0.686035",".":"M0.362549 0.851074 L0.239503 0.851074","/":"M0.062501 1.035249 L0.539551 0.270996","<":"M0.559083 0.441895 L0.042969 0.66939 L0.042969 0.66939 L0.559083 0.896902","=":"M0.042969 0.545898 L0.559083 0.545898 M0.042969 0.80837 L0.559083 0.80837",">":"M0.042969 0.441895 L0.559083 0.66939 L0.559083 0.66939 L0.042969 0.896902",A:"M0.018067 0.94897 L0.290179 0.270996 L0.583986 0.94897 M0.155303 0.684521 L0.433548 0.684521",B:"M0.063965 0.94897 L0.063965 0.278953 L0.209356 0.270996 L0.342486 0.294394 L0.432179 0.37292 L0.418224 0.48773 L0.312686 0.549166 L0.084728 0.575531 L0.306377 0.589434 L0.468877 0.647456 L0.538087 0.736658 L0.5324 0.85202 L0.501247 0.902983 L0.42355 0.944398 L0.063965 0.94897",C:"M0.529054 0.419847 L0.498425 0.345196 L0.442238 0.292341 L0.33583 0.257813 L0.257199 0.268357 L0.187906 0.303748 L0.120243 0.385432 L0.072998 0.599844 L0.110073 0.815385 L0.165381 0.902183 L0.222883 0.942801 L0.334904 0.961214 L0.43253 0.937679 L0.504816 0.868999 L0.529054 0.772065",D:"M0.064454 0.94897 L0.071838 0.285078 L0.171217 0.270996 L0.247348 0.272633 L0.37101 0.306078 L0.462461 0.378304 L0.514748 0.475555 L0.535591 0.576392 L0.537599 0.652313 L0.528065 0.717381 L0.508562 0.772419 L0.445948 0.855695 L0.362356 0.90871 L0.225203 0.945862 L0.064454 0.94897",E:"M0.080078 0.270996 L0.080078 0.94897 M0.080078 0.270996 L0.521974 0.270996 M0.080078 0.609981 L0.389405 0.609981 M0.080078 0.94897 L0.521974 0.94897",F:"M0.086426 0.270996 L0.086426 0.94897 M0.091304 0.275607 L0.515626 0.275607 M0.091304 0.607677 L0.447344 0.607677",G:"M0.498034 0.284943 L0.374621 0.257813 L0.244219 0.268648 L0.160577 0.311997 L0.094556 0.398116 L0.056397 0.58404 L0.076752 0.785532 L0.120865 0.858197 L0.188947 0.916734 L0.271008 0.953591 L0.357069 0.961214 L0.43715 0.932047 L0.501262 0.858539 L0.545656 0.648611 L0.329595 0.648131",H:"M0.066895 0.270996 L0.066895 0.94897 M0.066895 0.595658 L0.530009 0.595658 M0.535157 0.270996 L0.535157 0.94897",I:"M0.301026 0.270996 L0.301026 0.94897",J:"M0.506839 0.270996 L0.507814 0.782193 L0.498468 0.846168 L0.480733 0.880789 L0.455864 0.90832 L0.426095 0.929408 L0.360746 0.954812 L0.302508 0.962139 L0.223573 0.953638 L0.16538 0.930312 L0.137072 0.907715 L0.116428 0.880312 L0.102822 0.848819 L0.095633 0.813947 L0.094239 0.776413",K:"M0.035401 0.270996 L0.035401 0.94897 M0.502258 0.316194 L0.035401 0.687823 M0.212484 0.582361 L0.566652 0.933903",L:"M0.07544 0.270996 L0.07544 0.94897 L0.526613 0.94897",M:"M0.042481 0.94897 L0.042481 0.270996 L0.301027 0.712492 L0.559571 0.270996 L0.559571 0.94897",N:"M0.067871 0.94897 L0.067871 0.270996 L0.534181 0.94897 L0.525031 0.270996",O:"M0.287293 0.961214 L0.19843 0.933567 L0.1172 0.849451 L0.057129 0.563945 L0.114348 0.350255 L0.18455 0.289392 L0.306101 0.257813 L0.42054 0.29572 L0.487543 0.365003 L0.544923 0.625294 L0.516366 0.789624 L0.465476 0.884596 L0.375084 0.949287 L0.287293 0.961214",P:"M0.070557 0.94897 L0.070557 0.28379 L0.20704 0.270996 L0.329134 0.278993 L0.408525 0.300514 L0.444022 0.317908 L0.500637 0.368929 L0.525796 0.423728 L0.531496 0.50384 L0.508934 0.554205 L0.473724 0.582043 L0.417577 0.604365 L0.336375 0.620372 L0.226014 0.629268 L0.082368 0.630258",Q:"M0.282435 1.050813 L0.195447 1.019646 L0.115933 0.924817 L0.057129 0.602943 L0.113139 0.362034 L0.18186 0.293418 L0.300844 0.257813 L0.412868 0.300553 L0.478457 0.37866 L0.534625 0.672103 L0.506671 0.857367 L0.456855 0.964437 L0.368371 1.037368 L0.282435 1.050813 M0.341225 0.815559 L0.544923 1.070653",R:"M0.034912 0.944112 L0.034912 0.288556 L0.227127 0.270996 L0.362038 0.276867 L0.443423 0.294907 L0.477644 0.309614 L0.505809 0.328757 L0.526616 0.352817 L0.544963 0.418061 L0.543241 0.475921 L0.524463 0.517817 L0.49076 0.546518 L0.444265 0.564799 L0.355195 0.578739 L0.047653 0.589627 M0.303054 0.617306 L0.56714 0.94897",S:"M0.483037 0.364333 L0.407613 0.267477 L0.22883 0.257813 L0.128623 0.327565 L0.087712 0.455539 L0.104656 0.518727 L0.168054 0.573307 L0.41928 0.617318 L0.503796 0.669342 L0.535157 0.759324 L0.493846 0.900055 L0.367668 0.961214 L0.205436 0.956661 L0.116711 0.907038 L0.066895 0.790334",T:"M0.022949 0.270996 L0.579103 0.270996 M0.309284 0.270996 L0.309284 0.94897",U:"M0.072022 0.270996 L0.07308 0.648875 L0.080372 0.75167 L0.099024 0.827813 L0.134786 0.885729 L0.181571 0.924023 L0.251464 0.95168 L0.339655 0.962139 L0.401553 0.951668 L0.45232 0.924086 L0.482701 0.891771 L0.495745 0.870529 L0.515699 0.81637 L0.525014 0.744626 L0.530031 0.272017",V:"M0.027832 0.270996 L0.320083 0.94897 L0.57422 0.270996",W:"M0 0.270996 L0.079799 0.940377 L0.285198 0.472884 L0.505255 0.94897 L0.602052 0.270996",X:"M0.009034 0.270996 L0.586805 0.94897 M0.593019 0.270996 L0.015246 0.94897",Y:"M0.018067 0.270996 L0.293132 0.574135 M0.583986 0.271959 L0.294954 0.57606 L0.305277 0.94897",Z:"M0.053711 0.270996 L0.548341 0.270996 L0.053711 0.94897 L0.548341 0.94897","[":"M0.404542 0.240234 L0.197511 0.240234 L0.197511 1.069424 L0.404542 1.069424","\\":"M0.062501 0.270996 L0.539551 1.035249","]":"M0.19751 0.240234 L0.404542 0.240234 L0.404542 1.069424 L0.19751 1.069424","^":"M0.035156 0.523931 L0.301024 0.270996 L0.566896 0.523931",_:"M0 1.160601 L0.602052 1.160601",a:"M0.527101 0.439941 L0.527101 0.973965 M0.527101 0.553824 L0.451366 0.477535 L0.376759 0.439941 L0.263722 0.439941 L0.187989 0.477535 L0.112255 0.553824 L0.074951 0.66881 L0.074951 0.745099 L0.112255 0.85898 L0.187989 0.93527 L0.263722 0.973965 L0.376759 0.973965 L0.451366 0.93527 L0.527101 0.85898",b:"M0.07666 0.240234 L0.07666 0.959985 M0.07666 0.582737 L0.151822 0.514237 L0.225865 0.480483 L0.338045 0.480483 L0.413211 0.514237 L0.488374 0.582737 L0.525392 0.685983 L0.525392 0.754485 L0.488374 0.856739 L0.413211 0.92524 L0.338045 0.959985 L0.225865 0.959985 L0.151822 0.92524 L0.07666 0.856739",c:"M0.512452 0.553823 L0.441624 0.477535 L0.371854 0.439941 L0.26614 0.439941 L0.195312 0.477535 L0.124486 0.553823 L0.0896 0.668808 L0.0896 0.745099 L0.124486 0.858979 L0.195312 0.93527 L0.26614 0.973965 L0.371854 0.973965 L0.441624 0.93527 L0.512452 0.858979",d:"M0.525392 0.240234 L0.525392 0.959985 M0.525392 0.582737 L0.450232 0.514237 L0.376189 0.480483 L0.264006 0.480483 L0.188844 0.514237 L0.11368 0.582737 L0.076661 0.685983 L0.076661 0.754485 L0.11368 0.856739 L0.188844 0.92524 L0.264006 0.959985 L0.376189 0.959985 L0.450232 0.92524 L0.525392 0.856739",e:"M0.059571 0.668808 L0.542482 0.668808 M0.542482 0.592521 L0.502641 0.516231 L0.461594 0.477535 L0.381914 0.439941 L0.261186 0.439941 L0.180299 0.477535 L0.099412 0.553823 L0.059571 0.668808 L0.059571 0.745099 L0.099412 0.858979 L0.180299 0.93527 L0.261186 0.973965 L0.381914 0.973965 L0.461594 0.93527 L0.542482 0.858979",f:"M0.512941 0.240234 L0.406984 0.240234 L0.301026 0.274346 L0.248047 0.374731 L0.248047 0.946817 M0.089112 0.476088 L0.459965 0.476088",g:"M0.525392 0.439941 L0.525392 0.989395 L0.488373 1.091918 L0.45023 1.126757 L0.376189 1.160601 L0.264004 1.160601 L0.188844 1.126757 L0.113681 1.058075 L0.076661 0.954555 M0.525392 0.542467 L0.45023 0.473786 L0.376189 0.439941 L0.264004 0.439941 L0.188844 0.473786 L0.113681 0.542467 L0.076661 0.645988 L0.076661 0.714669 L0.113681 0.817193 L0.188844 0.885875 L0.264004 0.920713 L0.376189 0.920713 L0.45023 0.885875 L0.525392 0.817193",h:"M0.092041 0.240234 L0.092041 0.946817 M0.092041 0.61058 L0.205937 0.509225 L0.282214 0.476086 L0.396109 0.476086 L0.47187 0.509225 L0.510011 0.61058 L0.510011 0.946817",i:"M0.261026 0.240234 L0.341026 0.240234 M0.300978 0.476089 L0.300978 0.946817",j:"M0.3853 0.240234 L0.447023 0.240234 M0.416159 0.465708 L0.416159 1.011689 L0.383887 1.108586 L0.252832 1.140264 L0.15503 1.108586",k:"M0.065186 0.240234 L0.065186 0.946817 M0.493824 0.476086 L0.065186 0.812323 M0.236758 0.677829 L0.536867 0.946817",l:"M0.301026 0.234863 L0.301026 0.946441",m:"M0.050538 0.439941 L0.050538 0.960796 M0.050538 0.588758 L0.114405 0.476607 L0.157178 0.439941 L0.236864 0.439941 L0.279637 0.476607 L0.32241 0.588758 L0.32241 0.960796 M0.32241 0.588758 L0.386281 0.476607 L0.428467 0.439941 L0.50874 0.439941 L0.551515 0.476607 L0.551515 0.960796",n:"M0.092041 0.439941 L0.092041 0.960796 M0.092041 0.588758 L0.205936 0.476607 L0.282216 0.439941 L0.396113 0.439941 L0.471871 0.476607 L0.510011 0.588758 L0.510011 0.960796",o:"M0.247175 0.439941 L0.175178 0.477535 L0.103186 0.553823 L0.066895 0.668808 L0.066895 0.745099 L0.103186 0.858979 L0.175178 0.93527 L0.247175 0.973965 L0.354874 0.973965 L0.426872 0.93527 L0.498866 0.858979 L0.535157 0.745099 L0.535157 0.668808 L0.498866 0.553823 L0.426872 0.477535 L0.354874 0.439941 L0.247175 0.439941",p:"M0.076904 0.439941 L0.076904 1.154244 M0.076904 0.541563 L0.151986 0.473487 L0.225944 0.439941 L0.338005 0.439941 L0.413087 0.473487 L0.488166 0.541563 L0.525148 0.644169 L0.525148 0.712246 L0.488166 0.813866 L0.413087 0.881942 L0.338005 0.916471 L0.225944 0.916471 L0.151986 0.881942 L0.076904 0.813866",q:"M0.525148 0.441895 L0.525148 1.156195 M0.525148 0.5435 L0.450067 0.47544 L0.376106 0.441895 L0.264042 0.441895 L0.188966 0.47544 L0.113885 0.5435 L0.076905 0.646108 L0.076905 0.714187 L0.113885 0.815809 L0.188966 0.883886 L0.264042 0.918418 L0.376106 0.918418 L0.450067 0.883886 L0.525148 0.815809",r:"M0.107422 0.439941 L0.107422 0.960796 M0.107422 0.663164 L0.155824 0.551014 L0.252626 0.476607 L0.349428 0.439941 L0.49463 0.439941",s:"M0.475556 0.477535 L0.400757 0.439941 L0.276092 0.439941 L0.176361 0.477535 L0.101563 0.553823 L0.101563 0.630112 L0.176361 0.668808 L0.301024 0.668808 L0.425688 0.745099 L0.50049 0.821387 L0.50049 0.897677 L0.425688 0.93527 L0.325956 0.973965 L0.201295 0.973965 L0.126496 0.93527 L0.101563 0.858979",t:"M0.246032 0.297852 L0.246032 0.826549 L0.301023 0.919323 L0.411011 0.950848 L0.520997 0.950848 M0.081055 0.515799 L0.466004 0.515799",u:"M0.092041 0.454102 L0.092041 0.826134 L0.13018 0.937211 L0.205936 0.974954 L0.319832 0.974954 L0.396113 0.937211 L0.510011 0.826134 M0.510011 0.454102 L0.510011 0.974954",v:"M0.048828 0.453125 L0.301026 0.961719 M0.553224 0.453125 L0.301026 0.961719",w:"M0 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.451539 0.961719 M0.602052 0.453125 L0.451539 0.961719",x:"M0.03711 0.453125 L0.564943 0.961719 M0.564943 0.453125 L0.03711 0.961719",y:"M0.084618 0.453125 L0.320232 0.921476 M0.55713 0.453125 L0.320232 0.921476 L0.242119 1.055289 L0.163369 1.122196 L0.084618 1.155166 L0.044922 1.155166",z:"M0.505373 0.452148 L0.09668 0.961651 M0.09668 0.452148 L0.505373 0.452148 M0.09668 0.961651 L0.505373 0.961651"},E2={};for(let t52 in R2){E2[t52]=[];let e5=R2[t52].split("M").slice(1).map(t53=>t53.split("L").map(t54=>t54.trim().split(" ").map(parseFloat)));for(let n4 of e5)for(let e6=0;e6<n4.length-1;e6++)E2[t52].push({x1:n4[e6][0],y1:1-n4[e6][1],x2:n4[e6+1][0],y2:1-n4[e6+1][1]})}new TextEncoder,(()=>{let t52=new Uint8Array(4);new Uint32Array(t52.buffer)[0]=1,t52[0]})(),globalThis.Int8Array,globalThis.Uint8Array,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.BigUint64Array,globalThis.BigInt64Array,globalThis.Float32Array,globalThis.Float64Array;var A3=[];for(let t52=0;t52<256;t52++){let e5=t52;for(let t53=0;t53<8;t53++)1&e5?e5=3988292384^e5>>>1:e5>>>=1;A3[t52]=e5}var O2=new Uint16Array([255]),L2=(new Uint8Array(O2.buffer)[0],new Uint16Array([255]));new Uint8Array(L2.buffer)[0],new Uint8Array(0),Uint8Array.of(137,80,78,71,13,10,26,10),new TextDecoder("latin1");function D3(){return D3=Object.assign?Object.assign.bind():function(t52){for(var e5=1;e5<arguments.length;e5++){var n4=arguments[e5];for(var o4 in n4)({}).hasOwnProperty.call(n4,o4)&&(t52[o4]=n4[o4])}return t52},D3.apply(null,arguments)}function k3(t52,e5){return(k3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t53,e6){return t53.__proto__=e6,t53})(t52,e5)}function z3(t52){return(z3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t53){return t53.__proto__||Object.getPrototypeOf(t53)})(t52)}function j2(){try{var t52=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(j2=function(){return!!t52})()}function F3(t52){var e5=typeof Map=="function"?new Map:void 0;return F3=function(t53){if(t53===null||!(function(t54){try{return Function.toString.call(t54).indexOf("[native code]")!==-1}catch{return typeof t54=="function"}})(t53))return t53;if(typeof t53!="function")throw new TypeError("Super expression must either be null or a function");if(e5!==void 0){if(e5.has(t53))return e5.get(t53);e5.set(t53,n4)}function n4(){return(function(t54,e6,n5){if(j2())return Reflect.construct.apply(null,arguments);var o4=[null];o4.push.apply(o4,e6);var i3=new(t54.bind.apply(t54,o4));return n5&&k3(i3,n5.prototype),i3})(t53,arguments,z3(this).constructor)}return n4.prototype=Object.create(t53.prototype,{constructor:{value:n4,enumerable:!1,writable:!0,configurable:!0}}),k3(n4,t53)},F3(t52)}var $4={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
|
|
338
339
|
|
|
339
340
|
`,2:`Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
|
|
340
341
|
|
|
@@ -646,7 +647,7 @@ ${childDivs.join(`
|
|
|
646
647
|
`),color:translateColor(pin.color)})}}let networks=getGraphNetworkIds(g6);for(let ni3=0;ni3<networks.length;ni3++){let networkId=networks[ni3],networkColor=getColorByIndex(ni3,networks.length,.5),pinsInNetworkWithPosition=g6.pins.filter(p4=>p4.networkId===networkId).map(pin=>({pin,position:pinPositions.get(`${pin.boxId}.${pin.pinId}`)}));for(let i3=0;i3<pinsInNetworkWithPosition.length;i3++){let{position:pos1}=pinsInNetworkWithPosition[i3];for(let j4=i3+1;j4<pinsInNetworkWithPosition.length;j4++){let{position:pos2}=pinsInNetworkWithPosition[j4];graphics.lines.push({points:[pos1,pos2],strokeColor:opts?.grayNetworks?"rgba(0, 0, 0, 0.05)":networkColor})}}}let bounds=getBounds(graphics);return opts?.title&&(graphics.title=opts.title,graphics.texts.push({text:opts.title,x:bounds.minX,y:bounds.maxY,fontSize:(bounds.maxY-bounds.minY)*.05,anchorSide:"bottom_left"})),opts?.caption&&graphics.texts.push({text:opts.caption,x:bounds.minX,y:bounds.minY,fontSize:(bounds.maxY-bounds.minY)*.05,anchorSide:"top_left"}),graphics},getPinPosition=(g6,boxId,pinId)=>{let pin=g6.pins.find(p4=>p4.pinId===pinId&&p4.boxId===boxId);if(!pin)throw new Error(`Pin "${pinId}" not found`);let box2=g6.boxes.find(b3=>b3.boxId===pin.boxId);if(!box2)throw new Error(`Box "${pin.boxId}" not found`);let boxCenter=box2.center??{x:0,y:0};return{x:pin.offset.x+boxCenter.x,y:pin.offset.y+boxCenter.y}},getPinDirectionOrThrow=(g6,boxIdOrBox,pinIdOrPin)=>{let pin=typeof pinIdOrPin=="string"?g6.pins.find(p4=>p4.pinId===pinIdOrPin&&p4.boxId===boxIdOrBox):pinIdOrPin;if(!pin)throw new Error(`Pin not found "${pinIdOrPin}"`);if(!(typeof boxIdOrBox=="string"?g6.boxes.find(b3=>b3.boxId===boxIdOrBox):boxIdOrBox))throw new Error(`Box not found for pin "${pinIdOrPin}" (looked for "${pin.boxId}")`);let bounds=getBoundsOfBpcBox(g6,pin.boxId),pinPosition=getPinPosition(g6,pin.boxId,pin.pinId),width=bounds.maxX-bounds.minX,height=bounds.maxY-bounds.minY;if(width===0&&height===0)return Math.abs(pin.offset.x)>Math.abs(pin.offset.y)?pin.offset.x>0?"x+":"x-":pin.offset.y>0?"y+":"y-";if(width===0){if(Math.abs(pinPosition.y-bounds.minY)<1e-4)return"y-";if(Math.abs(pinPosition.y-bounds.maxY)<1e-4)return"y+"}if(height===0){if(Math.abs(pinPosition.x-bounds.minX)<1e-4)return"x-";if(Math.abs(pinPosition.x-bounds.maxX)<1e-4)return"x+"}let onLeftEdge=Math.abs(pinPosition.x-bounds.minX)<1e-4,onRightEdge=Math.abs(pinPosition.x-bounds.maxX)<1e-4,onBottomEdge=Math.abs(pinPosition.y-bounds.minY)<1e-4,onTopEdge=Math.abs(pinPosition.y-bounds.maxY)<1e-4;if((onLeftEdge||onRightEdge)&&(onBottomEdge||onTopEdge))return pin.offset.x>0?"x+":"x-";if(onLeftEdge)return"x-";if(onRightEdge)return"x+";if(onBottomEdge)return"y-";if(onTopEdge)return"y+";throw new Error(`Pin "${pin.pinId}" not on the edge of the box "${pin.boxId}" so we couldn't determine the direction`)},getPinDirection=(g6,boxIdOrBox,pinIdOrPin)=>{try{return getPinDirectionOrThrow(g6,boxIdOrBox,pinIdOrPin)}catch{return null}};var getAdjacencyMatrixFromFlatBpcGraph=flatBpcGraph=>{let nodeIdToIndex=new Map,indexMapping=[];flatBpcGraph.nodes.forEach((node,idx)=>{nodeIdToIndex.set(node.id,idx),indexMapping.push(node.id)});let N4=flatBpcGraph.nodes.length,matrix2=Array.from({length:N4},()=>Array.from({length:N4},()=>0));for(let[id1,id2]of flatBpcGraph.undirectedEdges){let i3=nodeIdToIndex.get(id1),j4=nodeIdToIndex.get(id2);i3!==void 0&&j4!==void 0&&i3!==j4&&(matrix2[i3][j4]=1,matrix2[j4][i3]=1)}for(let i3=0;i3<N4;++i3)matrix2[i3][i3]=1;return{matrix:matrix2,mapping:nodeIdToIndex,indexMapping}};var convertToFlatBpcGraph=mixed=>{var _a415;let nodes=[],undirectedEdges=[],boxCenterMap=new Map;for(let box2 of mixed.boxes)box2.kind,boxCenterMap.set(box2.boxId,box2.center),nodes.push({id:box2.boxId,boxId:box2.boxId,color:"box",x:box2.center?.x,y:box2.center?.y});let pinsByNetwork={};for(let pin of mixed.pins){let nodeId=`${pin.boxId}-${pin.pinId}`,bCenter=boxCenterMap.get(pin.boxId);nodes.push({id:nodeId,boxId:pin.boxId,pinId:pin.pinId,color:pin.color,x:bCenter?bCenter.x+pin.offset.x:void 0,y:bCenter?bCenter.y+pin.offset.y:void 0}),pinsByNetwork[_a415=pin.networkId]??(pinsByNetwork[_a415]=[]),pinsByNetwork[pin.networkId].push(nodeId)}for(let nodeIds of Object.values(pinsByNetwork))for(let i3=0;i3<nodeIds.length;i3++)for(let j4=i3+1;j4<nodeIds.length;j4++)undirectedEdges.push([nodeIds[i3],nodeIds[j4]]);for(let box2 of mixed.boxes)for(let pin of mixed.pins)pin.boxId===box2.boxId&&undirectedEdges.push([box2.boxId,`${box2.boxId}-${pin.pinId}`]);return{nodes,undirectedEdges}},wlFeatureVec=(adjMatrix,K3,opts={})=>{let n4=adjMatrix.length;if(adjMatrix.some(row=>row.length!==n4))throw new Error("adjMatrix must be square");let colors=(opts.nodeInitialColors??Array.from({length:n4},()=>"_")).slice(),getCounts=cols=>{let counts={};for(let c4 of cols)counts[c4]=(counts[c4]??0)+1;return counts},countsArr=[];countsArr.push(getCounts(colors));for(let step=0;step<K3;step++){let next2=Array(n4);for(let v4=0;v4<n4;v4++){let neigh=[];for(let u5=0;u5<n4;u5++)adjMatrix[v4][u5]&&neigh.push(colors[u5]);neigh.sort(),next2[v4]=`${colors[v4]}|${neigh.join(",")}`}colors=next2,countsArr.push(getCounts(colors))}return countsArr},wlVecWeightedJaccardSimilarity=(wlFeatureVec1,wlFeatureVec2)=>{let total=0,len=Math.min(wlFeatureVec1.length,wlFeatureVec2.length);for(let i3=0;i3<len;i3++){let rec1=wlFeatureVec1[i3],rec2=wlFeatureVec2[i3],allKeys=new Set([...Object.keys(rec1),...Object.keys(rec2)]),sumMin=0,sumMax=0;for(let k4 of allKeys){let v12=rec1[k4]??0,v22=rec2[k4]??0;sumMin+=Math.min(v12,v22),sumMax+=Math.max(v12,v22)}total+=sumMax===0?0:sumMin/sumMax}return total};var getWlDotProduct=wlVecWeightedJaccardSimilarity,DEFAULT_WL_DEGREES=2,getWlFeatureVecs=(g6,wlDegrees=DEFAULT_WL_DEGREES)=>{let flatBpc=convertToFlatBpcGraph(g6),{matrix:matrix2,indexMapping}=getAdjacencyMatrixFromFlatBpcGraph(flatBpc);return wlFeatureVec(matrix2,wlDegrees,{nodeInitialColors:indexMapping.map(id2=>flatBpc.nodes.find(n4=>n4.id===id2)?.color??"_")})},getBpcGraphWlDistance=(g12,g22,{wlDegrees=DEFAULT_WL_DEGREES}={})=>{let wlVec1=getWlFeatureVecs(g12,wlDegrees),wlVec2=getWlFeatureVecs(g22,wlDegrees);return(DEFAULT_WL_DEGREES+1-getWlDotProduct(wlVec1,wlVec2))/(DEFAULT_WL_DEGREES+1)},hashStringToNumber=str=>{let hash=0;for(let i3=0;i3<str.length;i3++)hash=(hash<<5)-hash+str.charCodeAt(i3);return Math.abs(hash)},convertFlatBpcToGraphics=(flat,opts={})=>{let gfx={points:[],lines:[],rects:[],circles:[],texts:[],coordinateSystem:"cartesian",title:"Flat-BPC Graphics"},pos=new Map;for(let n4 of flat.nodes){if(n4.x===void 0||n4.y===void 0)continue;let p4={x:n4.x,y:n4.y};pos.set(n4.id,p4),gfx.points.push({...p4,color:translateColor(n4.color),label:n4.id})}for(let[a3,b3]of flat.undirectedEdges){let pa3=pos.get(a3),pb2=pos.get(b3);pa3&&pb2&&gfx.lines.push({points:[pa3,pb2],strokeColor:"rgba(0,0,0,0.3)"})}let bounds=getBounds(gfx);return opts.title&&gfx.texts.push({text:opts.title,x:bounds.minX,y:bounds.maxY,fontSize:(bounds.maxY-bounds.minY)*.05,anchorSide:"bottom_left"}),opts.caption&&gfx.texts.push({text:opts.caption,x:bounds.minX,y:bounds.minY,fontSize:(bounds.maxY-bounds.minY)*.05,anchorSide:"top_left"}),gfx};var getTotalNetworkLength=g6=>{let networkPins=new Map;for(let pin of g6.pins){let box2=g6.boxes.find(b3=>b3.boxId===pin.boxId);if(!box2||!box2.center)throw new Error(`Expected fixed graph \u2013 box "${pin.boxId}" missing or has no center`);let pos={x:box2.center.x+pin.offset.x,y:box2.center.y+pin.offset.y};networkPins.has(pin.networkId)||networkPins.set(pin.networkId,[]),networkPins.get(pin.networkId).push(pos)}let networkLengths=new Map,totalNetworkLength=0;for(let[netId,positions]of networkPins){if(positions.length===0){networkLengths.set(netId,0);continue}let centre=positions.reduce((acc,p4)=>({x:acc.x+p4.x,y:acc.y+p4.y}),{x:0,y:0});centre.x/=positions.length,centre.y/=positions.length;let len=positions.reduce((sum,p4)=>{let dx3=p4.x-centre.x,dy3=p4.y-centre.y;return sum+Math.sqrt(dx3*dx3+dy3*dy3)},0);networkLengths.set(netId,len),totalNetworkLength+=len}return{totalNetworkLength,networkLengths}},computeBagOfAnglesForNetwork=(g6,networkId)=>{let pins=g6.pins.filter(p4=>p4.networkId===networkId),angles=[];for(let pin of pins){let pinAngle=Math.atan2(pin.offset.y,pin.offset.x);angles.push(pinAngle)}return angles},computeGraphNetworkBagOfAnglesMap=g6=>{let map=new Map,networks=Array.from(new Set(g6.pins.map(p4=>p4.networkId)));for(let networkId of networks){let angles=computeBagOfAnglesForNetwork(g6,networkId);map.set(networkId,angles)}return map},circularDistance=(a3,b3)=>{let TAU=2*Math.PI,normA=(a3%TAU+TAU)%TAU,normB=(b3%TAU+TAU)%TAU,diff=Math.abs(normA-normB);return Math.min(diff,TAU-diff)},computeBagOfAnglesDistance=(bag1,bag2)=>{if(bag1.length===0&&bag2.length===0)return 0;if(bag1.length===0||bag2.length===0)return Math.PI;let avgNearest=(src,tgt)=>{let sum=0;for(let a3 of src){let best=1/0;for(let b3 of tgt){let d4=circularDistance(a3,b3);d4<best&&(best=d4)}sum+=best}return sum/src.length};return(avgNearest(bag1,bag2)+avgNearest(bag2,bag1))/2},computeNetworkMappingFromBagsOfAngles=(bag1,bag2)=>{let networkMapping=new Map,bag1Entries=Array.from(bag1.entries()),bag2Entries=Array.from(bag2.entries()),n12=bag1Entries.length,n22=bag2Entries.length,distanceMatrix=Array.from({length:n12},()=>new Array(n22).fill(0));for(let i3=0;i3<n12;i3++){let[,angles1]=bag1Entries[i3];for(let j4=0;j4<n22;j4++){let[,angles2]=bag2Entries[j4];distanceMatrix[i3][j4]=computeBagOfAnglesDistance(angles1,angles2)}}let unmapped1=new Set(Array.from({length:n12},(_4,i3)=>i3)),unmapped2=new Set(Array.from({length:n22},(_4,i3)=>i3)),totalDistance=0;for(;unmapped1.size&&unmapped2.size;){let bestI=-1,bestJ=-1,bestD=1/0;for(let i3 of unmapped1)for(let j4 of unmapped2){let d4=distanceMatrix[i3][j4];d4<bestD&&(bestD=d4,bestI=i3,bestJ=j4)}let[net1]=bag1Entries[bestI],[net2]=bag2Entries[bestJ];networkMapping.set(net1,net2),totalDistance+=bestD,unmapped1.delete(bestI),unmapped2.delete(bestJ)}let UNMATCHED_PENALTY=Math.PI;return totalDistance+=(unmapped1.size+unmapped2.size)*UNMATCHED_PENALTY,{networkMapping,distance:totalDistance}},getBoundsOfPinList=pins=>{let minX=Math.min(...pins.map(p4=>p4.offset.x)),maxX=Math.max(...pins.map(p4=>p4.offset.x)),minY=Math.min(...pins.map(p4=>p4.offset.y)),maxY=Math.max(...pins.map(p4=>p4.offset.y));return{minX,maxX,minY,maxY}},getNormalizedPerimeterDistance=(A4,B4)=>{let posToScalar=p4=>{switch(p4.side){case"x+":return p4.cwDistanceFromCorner;case"y-":return 1+p4.cwDistanceFromCorner;case"x-":return 2+p4.cwDistanceFromCorner;case"y+":return 3+p4.cwDistanceFromCorner}},a3=posToScalar(A4)%4,b3=posToScalar(B4)%4,cwDistance=(b3-a3+4)%4,ccwDistance=(a3-b3+4)%4,minDistance=Math.min(cwDistance,ccwDistance);return{cwDistance,ccwDistance,minDistance}},EPS=1e-6,getNormalizedPerimeterPosition=(bounds,position4)=>{let{minX,minY,maxX,maxY}=bounds,near=(a3,b3)=>Math.abs(a3-b3)<EPS,side,cwDistanceFromCorner;if(near(position4.x,maxX)&&position4.y>=minY-EPS&&position4.y<=maxY+EPS)side="x+",cwDistanceFromCorner=(maxY-position4.y)/(maxY-minY);else if(near(position4.y,maxY)&&position4.x<=maxX+EPS&&position4.x>=minX-EPS)side="y+",cwDistanceFromCorner=(position4.x-minX)/(maxX-minX);else if(near(position4.x,minX)&&position4.y<=maxY+EPS&&position4.y>=minY-EPS)side="x-",cwDistanceFromCorner=(position4.y-minY)/(maxY-minY);else if(near(position4.y,minY)&&position4.x>=minX-EPS&&position4.x<=maxX+EPS)side="y-",cwDistanceFromCorner=(maxX-position4.x)/(maxX-minX);else return null;return cwDistanceFromCorner=Math.min(1,Math.max(0,cwDistanceFromCorner)),{side,cwDistanceFromCorner}},matchPins=(pinList1,pinList2)=>{let matchedPins=[],unmatchedPin1Ids=new Set,unmatchedPin2Ids=new Set,matchedPin1Ids=new Set,matchedPin2Ids=new Set,bounds1=getBoundsOfPinList(pinList1),bounds2=getBoundsOfPinList(pinList2);for(let pin1 of pinList1){let matchingPinsByColor=pinList2.filter(p22=>p22.color===pin1.color).filter(p22=>!matchedPin2Ids.has(p22.pinId));if(matchingPinsByColor.length===0){unmatchedPin1Ids.add(pin1.pinId);continue}let normalizedPerimeterPosition1=getNormalizedPerimeterPosition(bounds1,pin1.offset);if(normalizedPerimeterPosition1===null){unmatchedPin1Ids.add(pin1.pinId);continue}let bestPerimeterDistance=1/0,bestMatchingPin2=matchingPinsByColor[0];for(let pin2 of matchingPinsByColor){let normalizedPerimeterPosition2=getNormalizedPerimeterPosition(bounds2,pin2.offset);if(normalizedPerimeterPosition2===null)continue;let{minDistance}=getNormalizedPerimeterDistance(normalizedPerimeterPosition1,normalizedPerimeterPosition2);minDistance<bestPerimeterDistance&&(bestPerimeterDistance=minDistance,bestMatchingPin2=pin2)}matchedPins.push([pin1,bestMatchingPin2]),matchedPin1Ids.add(pin1.pinId),matchedPin2Ids.add(bestMatchingPin2.pinId)}for(let pin2 of pinList2)matchedPin2Ids.has(pin2.pinId)||unmatchedPin2Ids.add(pin2.pinId);return{matchedPins,unmatchedPin1Ids,unmatchedPin2Ids}},AssignmentSolver2=class{constructor(floatingGraph,fixedGraph){__publicField(this,"wipGraph");__publicField(this,"iterations",0);__publicField(this,"solved",!1);__publicField(this,"acceptedFloatingBoxIds",new Set);__publicField(this,"rejectedFloatingBoxIds",new Set);__publicField(this,"acceptedFixedBoxIds",new Set);__publicField(this,"assignment",new Map);__publicField(this,"lastAcceptedEvaluation",null);__publicField(this,"fixedToFloatingNetworkMap");__publicField(this,"floatingToFixedNetworkMap");__publicField(this,"lastComputedEvaluations",[]);this.floatingGraph=floatingGraph,this.fixedGraph=fixedGraph,this.wipGraph={pins:[],boxes:[]},this.fixedToFloatingNetworkMap=this.computeFixedToFloatingNetworkMap(),this.floatingToFixedNetworkMap=new Map(Array.from(this.fixedToFloatingNetworkMap.entries()).map(([k4,v4])=>[v4,k4]))}computeFixedToFloatingNetworkMap(){let floatingBagOfAnglesMap=computeGraphNetworkBagOfAnglesMap(this.floatingGraph),fixedBagOfAnglesMap=computeGraphNetworkBagOfAnglesMap(this.fixedGraph),{networkMapping}=computeNetworkMappingFromBagsOfAngles(fixedBagOfAnglesMap,floatingBagOfAnglesMap);return networkMapping}getNextFloatingBoxId(){let remainingFloatingBoxIds=this.floatingGraph.boxes.map(b3=>b3.boxId).filter(b3=>!this.acceptedFloatingBoxIds.has(b3)&&!this.rejectedFloatingBoxIds.has(b3));if(!remainingFloatingBoxIds.length)throw new Error("No remaining floating box ids");let bestFloatingBoxId=remainingFloatingBoxIds[0],bestFloatingBoxPinCount=0;for(let floatingBoxId of remainingFloatingBoxIds){let floatingBoxPins=this.floatingGraph.pins.filter(p4=>p4.boxId===floatingBoxId);floatingBoxPins.length>bestFloatingBoxPinCount&&(bestFloatingBoxId=floatingBoxId,bestFloatingBoxPinCount=floatingBoxPins.length)}return bestFloatingBoxId}getRemainingFloatingBoxIds(){return this.floatingGraph.boxes.map(b3=>b3.boxId).filter(b3=>!this.acceptedFloatingBoxIds.has(b3)&&!this.rejectedFloatingBoxIds.has(b3))}getPartialFloatingGraph(nextFloatingBoxId){let g6={pins:[],boxes:[]};for(let box2 of this.floatingGraph.boxes)(this.acceptedFloatingBoxIds.has(box2.boxId)||box2.boxId===nextFloatingBoxId)&&(g6.boxes.push(box2),g6.pins.push(...this.floatingGraph.pins.filter(p4=>p4.boxId===box2.boxId)));return g6}evaluateFloatingBoxAssignment(nextFloatingBoxId){let partialFloatingGraph=this.getPartialFloatingGraph(nextFloatingBoxId),currentWlDist=getBpcGraphWlDistance(partialFloatingGraph,this.wipGraph),bestFixedBoxId=null,bestNewWipGraph=null,dEval={floatingBoxId:nextFloatingBoxId,originalWipGraph:this.wipGraph,partialFloatingGraph,currentWlDist,networkLengths:new Map,wlDistances:new Map,wlVecs:new Map,wipGraphsWithAddedFixedBoxId:new Map},bestDist=currentWlDist,bestWlDist=currentWlDist,bestTotalNetworkLength=1/0,floatingBoxWlVec=getWlFeatureVecs(partialFloatingGraph);for(let fixedBoxId of this.fixedGraph.boxes.map(b3=>b3.boxId)){if(this.acceptedFixedBoxIds.has(fixedBoxId))continue;let wipGraphWithAddedFixedBoxId=this.getWipGraphWithAddedFixedBoxIdForFloatingAssignment(fixedBoxId,nextFloatingBoxId),wlDist=getBpcGraphWlDistance(partialFloatingGraph,wipGraphWithAddedFixedBoxId),debug_wlVec=getWlFeatureVecs(wipGraphWithAddedFixedBoxId),{totalNetworkLength}=getTotalNetworkLength(wipGraphWithAddedFixedBoxId);dEval.wipGraphsWithAddedFixedBoxId.set(fixedBoxId,wipGraphWithAddedFixedBoxId),dEval.wlVecs.set(fixedBoxId,debug_wlVec),dEval.wlDistances.set(fixedBoxId,wlDist),dEval.networkLengths.set(fixedBoxId,totalNetworkLength);let dist=wlDist+totalNetworkLength/100;dist<bestDist&&(bestDist=dist,bestWlDist=wlDist,bestTotalNetworkLength=totalNetworkLength,bestNewWipGraph=wipGraphWithAddedFixedBoxId,bestFixedBoxId=fixedBoxId)}return{bestFixedBoxId,bestNewWipGraph,bestDist,bestWlDist,bestTotalNetworkLength,lastDistanceEvaluation:dEval,nextFloatingBoxId,partialFloatingGraph,floatingBoxWlVec}}getPinAssignment(){let pinAssignment={},fixedToFloatingBoxAssignment={};for(let[floatingBoxId,fixedBoxId]of this.assignment)pinAssignment[floatingBoxId]={},fixedToFloatingBoxAssignment[fixedBoxId]=floatingBoxId;for(let pin of this.wipGraph.pins){let fixedBoxId=pin.boxId,floatingBoxId=fixedToFloatingBoxAssignment[fixedBoxId],floatingPinId=pin._floatingPinId,fixedPinId=pin._fixedPinId;pinAssignment[floatingBoxId][floatingPinId]=fixedPinId}return pinAssignment}step(){if(this.solved)return;if(this.iterations>1e3)throw new Error("Too many iterations");if(this.iterations++,this.iterations===1){let nextFloatingBoxId=this.getNextFloatingBoxId(),evalResult=this.evaluateFloatingBoxAssignment(nextFloatingBoxId);this.lastComputedEvaluations=[evalResult],this.acceptEvaluationResult(evalResult);return}let remainingFloatingBoxIds=this.getRemainingFloatingBoxIds();if(remainingFloatingBoxIds.length===0){this.solved=!0;return}let bestEvalDist=1/0,bestEvalResult=null;this.lastComputedEvaluations=[];for(let floatingBoxId of remainingFloatingBoxIds){let evalResult=this.evaluateFloatingBoxAssignment(floatingBoxId);this.lastComputedEvaluations.push(evalResult),evalResult.bestDist<bestEvalDist&&(bestEvalDist=evalResult.bestDist,bestEvalResult=evalResult)}bestEvalResult&&this.acceptEvaluationResult(bestEvalResult)}acceptEvaluationResult(evalResult){let{bestFixedBoxId,bestNewWipGraph,nextFloatingBoxId}=evalResult;if(bestFixedBoxId===null){this.rejectedFloatingBoxIds.add(nextFloatingBoxId);return}this.acceptedFloatingBoxIds.add(nextFloatingBoxId),this.assignment.set(nextFloatingBoxId,bestFixedBoxId),this.acceptedFixedBoxIds.add(bestFixedBoxId),this.wipGraph=bestNewWipGraph,this.lastAcceptedEvaluation=evalResult.lastDistanceEvaluation}getWipGraphWithAddedFixedBoxIdForFloatingAssignment(fixedBoxId,floatingBoxId){let g6=structuredClone(this.wipGraph),boxToAdd=this.fixedGraph.boxes.find(b3=>b3.boxId===fixedBoxId);g6.boxes.push(boxToAdd);let floatingBoxPins=this.floatingGraph.pins.filter(p4=>p4.boxId===floatingBoxId),fixedBoxPins=this.fixedGraph.pins.filter(p4=>p4.boxId===fixedBoxId),{matchedPins}=matchPins(floatingBoxPins,fixedBoxPins);return g6.pins.push(...matchedPins.map(p4=>{let[floatingPin,fixedPin]=p4;return{...fixedPin,networkId:this.floatingToFixedNetworkMap.get(floatingPin.networkId),_floatingPinId:floatingPin.pinId,_fixedPinId:fixedPin.pinId}})),g6}visualize(){let floatingGraphics=getGraphicsForBpcGraph(this.floatingGraph,{title:"Floating"}),wipGraphics=getGraphicsForBpcGraph(this.wipGraph,{title:"WIP"}),fixedGraphics=getGraphicsForBpcGraph(this.fixedGraph,{title:"Fixed"}),floatingPartialGraphics=getGraphicsForBpcGraph(this.getPartialFloatingGraph(),{title:"Partial Floating"}),colorByFloatingId=new Map,fixedToFloating=new Map;for(let[floatId,fixedId]of this.assignment){let colour=getColorByIndex(hashStringToNumber(floatId)*47%100,100,.5);colorByFloatingId.set(floatId,colour),fixedToFloating.set(fixedId,floatId)}function decorateRect(rect,floatId,fixedId){let colour=colorByFloatingId.get(floatId);rect.fill=colour,rect.label=`${floatId}\u2192${fixedId}`}for(let rect of floatingGraphics.rects??[]){let floatId=rect.label;if(!floatId)continue;let fixedId=this.assignment.get(floatId);fixedId&&decorateRect(rect,floatId,fixedId)}for(let rect of floatingPartialGraphics.rects??[]){let floatId=rect.label;if(!floatId)continue;let fixedId=this.assignment.get(floatId);fixedId&&decorateRect(rect,floatId,fixedId)}let targetGraphics=[wipGraphics,fixedGraphics];for(let g6 of targetGraphics)for(let rect of g6.rects??[]){let fixedId=rect.label;if(!fixedId)continue;let floatId=fixedToFloating.get(fixedId);floatId&&decorateRect(rect,floatId,fixedId)}let floatingFlatG=convertToFlatBpcGraph(this.floatingGraph),wipFlatG=convertToFlatBpcGraph(this.wipGraph),fixedFlatG=convertToFlatBpcGraph(this.fixedGraph),floatingFlatGraphics=convertFlatBpcToGraphics(floatingFlatG,{title:"Floating Flat"}),wipFlatGraphics=convertFlatBpcToGraphics(wipFlatG,{title:"WIP Flat"}),fixedFlatGraphics=convertFlatBpcToGraphics(fixedFlatG,{title:"Fixed Flat"});return stackGraphicsHorizontally([stackGraphicsVertically([floatingGraphics,floatingFlatGraphics,floatingPartialGraphics]),stackGraphicsVertically([wipGraphics,wipFlatGraphics]),stackGraphicsVertically([fixedGraphics,fixedFlatGraphics])])}},getApproximateAssignments2=(floatingGraph,fixedGraph)=>{let solver=new AssignmentSolver2(floatingGraph,fixedGraph);for(;!solver.solved&&solver.iterations<1e3;)solver.step();let boxAssignment={};for(let[floatingBoxId,fixedBoxId]of solver.assignment.entries())boxAssignment[floatingBoxId]=fixedBoxId;let networkAssignment={};for(let[floatingNetId,fixedNetId]of solver.floatingToFixedNetworkMap.entries())networkAssignment[floatingNetId]=fixedNetId;let pinAssignment=solver.getPinAssignment();return{floatingToFixedBoxAssignment:boxAssignment,floatingToFixedNetworkAssignment:networkAssignment,floatingToFixedPinAssignment:pinAssignment}};var mergeBoxSideSubgraphs=(graphs,{renetworkedNetworkIdMap}={})=>{if(renetworkedNetworkIdMap??(renetworkedNetworkIdMap={}),graphs.length===1)return graphs[0];let merged={boxes:[],pins:[]},boxMap=new Map,pinMap=new Map,partitionedBoxIds=Object.entries(graphs.flatMap(g6=>Array.from(new Set(g6.boxes.map(b3=>b3.boxId)))).reduce((acc,str)=>(acc[str]=(acc[str]||0)+1,acc),{})).filter(([_4,count])=>count===graphs.length).map(([str])=>str);if(partitionedBoxIds.length>1)throw new Error(`Expected at most one shared box across all partitions, the following box ids are shared across all graphs: ${partitionedBoxIds.join(", ")}`);let partitionedBoxId=partitionedBoxIds[0];for(let g6 of graphs){let offset=g6.boxes.find(b3=>b3.boxId===partitionedBoxId)?.center;for(let box2 of g6.boxes){if(boxMap.has(box2.boxId))continue;let modifiedBox=structuredClone(box2);modifiedBox.center&&offset&&(modifiedBox.center={x:modifiedBox.center.x-offset.x,y:modifiedBox.center.y-offset.y}),boxMap.set(box2.boxId,modifiedBox)}for(let pin of g6.pins)pinMap.has(`${pin.boxId}-${pin.pinId}`)||pinMap.set(`${pin.boxId}-${pin.pinId}`,structuredClone(pin))}return merged.boxes=Array.from(boxMap.values()),merged.pins=Array.from(pinMap.values()),merged};var reflectGraph=({graph,axis,centerBoxId})=>{let newGraph=structuredClone(graph),centreBox=newGraph.boxes.find(b3=>b3.boxId===centerBoxId);if(!centreBox||!centreBox.center)throw new Error(`Center box "${centerBoxId}" not found or has no center`);let{x:cx3,y:cy3}=centreBox.center;for(let box2 of newGraph.boxes)box2.center&&(axis==="x"?box2.center.x=2*cx3-box2.center.x:box2.center.y=2*cy3-box2.center.y);for(let pin of newGraph.pins)axis==="x"?pin.offset.x=-pin.offset.x:pin.offset.y=-pin.offset.y;return newGraph},getCanonicalRightFacingGraph=g6=>{let largestLeftRightBox=null,largestLeftRightBoxPins=-1/0;for(let box2 of g6.boxes){let lrPins2=g6.pins.filter(p4=>p4.boxId===box2.boxId).filter(p4=>["x-","x+"].includes(getPinDirection(g6,box2,p4)??"none"));lrPins2.length>largestLeftRightBoxPins&&lrPins2.length>1&&(largestLeftRightBox=box2,largestLeftRightBoxPins=lrPins2.length)}if(!largestLeftRightBox)return{g:g6,reflected:!1,centerBoxId:null};let largestBoxLRPinDirections=g6.pins.filter(p4=>p4.boxId===largestLeftRightBox.boxId).map(p4=>getPinDirection(g6,largestLeftRightBox,p4)),dirCounts={"x+":0,"x-":0,"y+":0,"y-":0};for(let dir2 of largestBoxLRPinDirections)dir2&&dirCounts[dir2]++;return dirCounts["x+"]>=dirCounts["x-"]?{g:g6,reflected:!1,centerBoxId:largestLeftRightBox.boxId}:{g:reflectGraph({graph:g6,axis:"x",centerBoxId:largestLeftRightBox.boxId}),reflected:!0,centerBoxId:largestLeftRightBox.boxId}},debug4=(0,import_debug4.default)("schematic-partition-processor"),SchematicPartitionProcessor=class{constructor(initialGraph,opts={}){__publicField(this,"lastGraph");__publicField(this,"lastExploredPin");__publicField(this,"solved",!1);__publicField(this,"iteration",0);__publicField(this,"wipPartitions");__publicField(this,"unexploredPins",[]);__publicField(this,"boxSingletonKeys");__publicField(this,"exploredPins");__publicField(this,"addedPins");__publicField(this,"allAcceptedPins",new Set);__publicField(this,"pinConnectionCount");__publicField(this,"networkSize");__publicField(this,"pinNetworkSize");__publicField(this,"splitBoxIds");__publicField(this,"acceptedBoxPartitionMap",new Map);__publicField(this,"singletonKeys");__publicField(this,"centerPinColors");this.initialGraph=initialGraph,this.lastGraph=initialGraph,this.singletonKeys=opts.singletonKeys??[],this.centerPinColors=opts.centerPinColors??[];let partitionInit=this.initializeWipPartitions();this.wipPartitions=partitionInit.wipPartitions,this.splitBoxIds=partitionInit.splitBoxIds,this.addedPins=partitionInit.addedPins,this.exploredPins=new Set,this.unexploredPins=this.wipPartitions.flatMap(part=>part.pins.map(p4=>({...p4,partitionId:part.partitionId}))),this.boxSingletonKeys=this.initializeBoxSingletonKeys(),this.pinConnectionCount=(()=>{let counts={};for(let pin of this.initialGraph.pins)counts[`${pin.boxId}:${pin.pinId}`]=this.getNeighbors(pin).length;return counts})();let netCounts={};for(let p4 of this.initialGraph.pins)netCounts[p4.networkId]=(netCounts[p4.networkId]??0)+1;this.networkSize=netCounts;let pNetSize={};for(let p4 of this.initialGraph.pins)pNetSize[`${p4.boxId}:${p4.pinId}`]=netCounts[p4.networkId];this.pinNetworkSize=pNetSize}initializeBoxSingletonKeys(){let boxSingletonKeys={};for(let box2 of this.initialGraph.boxes){let boxPins=this.initialGraph.pins.filter(p4=>p4.boxId===box2.boxId),boxPinCount=boxPins.length,singletonKeysForBox=boxPins.map(p4=>`${p4.color}/${boxPinCount}`).filter(k4=>this.singletonKeys.includes(k4));boxSingletonKeys[box2.boxId]=new Set(singletonKeysForBox)}return boxSingletonKeys}initializeWipPartitions(){let wipPartitions=[],addedPins=new Set,splitBoxIds=new Set,partitionId=0;for(let box2 of this.initialGraph.boxes){let pins=this.initialGraph.pins.filter(p4=>p4.boxId===box2.boxId).filter(p4=>getPinDirection(this.initialGraph,box2,p4)).filter(p4=>!this.centerPinColors.includes(p4.color));if(pins.length<4)continue;let uniqueDirections=new Set(pins.map(p4=>getPinDirection(this.initialGraph,box2,p4)));uniqueDirections.size>1&&splitBoxIds.add(box2.boxId);for(let direction2 of uniqueDirections){let partition={partitionId:`partition${partitionId++}`,filledSingletonSlots:new Set,pins:[]};for(let pin of pins)getPinDirection(this.initialGraph,box2,pin)===direction2&&(partition.pins.push({boxId:box2.boxId,pinId:pin.pinId}),addedPins.add(`${box2.boxId}:${pin.pinId}`));wipPartitions.push(partition)}}return wipPartitions.length===0&&(wipPartitions.push(this.createWipPartitionFromEntireGraph()),this.solved=!0),debug4(`splitBoxIds = ${Array.from(splitBoxIds).join(", ")}`),debug4(`wipPartitions = ${wipPartitions.map(p4=>p4.partitionId).join(", ")}`),{wipPartitions,splitBoxIds,addedPins}}createWipPartitionFromEntireGraph(){return{partitionId:"entire-graph",filledSingletonSlots:new Set,pins:this.initialGraph.pins.map(p4=>({boxId:p4.boxId,pinId:p4.pinId}))}}step(){if(this.solved)return;if(this.iteration++,debug4(`
|
|
647
648
|
\u2500\u2500 Iteration ${this.iteration} \u2500\u2500 unexplored=${this.unexploredPins.length} explored=${this.exploredPins.size}`),this.unexploredPins.sort((a3,b3)=>{let aKey=`${a3.boxId}:${a3.pinId}`,bKey=`${b3.boxId}:${b3.pinId}`,netDiff=this.pinNetworkSize[aKey]-this.pinNetworkSize[bKey];return netDiff!==0?netDiff:this.pinConnectionCount[aKey]-this.pinConnectionCount[bKey]}),this.unexploredPins.length===0){this.solved=!0;return}let current3=this.unexploredPins.shift(),currentPinKey=`${current3.boxId}:${current3.pinId}`;debug4(`Exploring pin ${current3.boxId}:${current3.pinId} for partition "${current3.partitionId}"`),this.lastExploredPin={...current3,partitionId:current3.partitionId};let currentPinPartitionKey=`${current3.partitionId}[${currentPinKey}]`,currentPin=this.initialGraph.pins.find(p4=>p4.boxId===current3.boxId&&p4.pinId===current3.pinId);if(!currentPin||this.exploredPins.has(currentPinPartitionKey))return;let currentPartition=this.wipPartitions.find(p4=>p4.partitionId===current3.partitionId);if(!currentPartition)return;let pinAlreadyAcceptedIntoPartitionId=this.acceptedBoxPartitionMap.get(current3.boxId);if(pinAlreadyAcceptedIntoPartitionId&&pinAlreadyAcceptedIntoPartitionId!==current3.partitionId&&!this.splitBoxIds.has(current3.boxId)){debug4(` \u21B3 rejected (box ${current3.boxId} for partition ${current3.partitionId} already in partition ${this.acceptedBoxPartitionMap.get(current3.boxId)})`),this.exploredPins.add(currentPinPartitionKey);return}let singletonKeysForBox=this.boxSingletonKeys[current3.boxId];if(Array.from(singletonKeysForBox).some(k4=>currentPartition.filledSingletonSlots.has(k4))){debug4(` \u21B3 rejected (singleton already in partition "${current3.partitionId}")`),this.exploredPins.add(currentPinPartitionKey);return}for(let k4 of singletonKeysForBox)currentPartition.filledSingletonSlots.add(k4);currentPartition.pins.push({boxId:current3.boxId,pinId:current3.pinId}),this.allAcceptedPins.add(currentPinKey),this.addedPins.add(currentPinKey),this.splitBoxIds.has(current3.boxId)||this.acceptedBoxPartitionMap.set(current3.boxId,current3.partitionId),this.exploredPins.add(currentPinPartitionKey),debug4(` \u21B3 accepted \u2192 pins in partition now = ${currentPartition.pins.length}`);let neighbors=this.getNeighbors(currentPin);for(let neighbor of neighbors){let neighborPinKey=`${neighbor.boxId}:${neighbor.pinId}`;this.addedPins.has(neighborPinKey)||this.centerPinColors.includes(neighbor.color)||this.exploredPins.has(`${current3.partitionId}[${neighborPinKey}]`)||this.unexploredPins.push({boxId:neighbor.boxId,pinId:neighbor.pinId,partitionId:current3.partitionId})}this.unexploredPins.length===0&&(this.solved=!0),this.solved&&debug4(`Solver finished in ${this.iteration} iterations, partitions=${this.getPartitions().length}`)}getNeighbors(pin){let neighbors=[];for(let pinInNetwork of this.initialGraph.pins)pinInNetwork.networkId===pin.networkId&&(pin.boxId===pinInNetwork.boxId&&pinInNetwork.pinId===pin.pinId||neighbors.push(pinInNetwork));for(let pinInBox of this.initialGraph.pins)pinInBox.boxId===pin.boxId&&neighbors.push(pinInBox);return neighbors}solve(){for(;!this.solved&&this.iteration<1e3;)this.step()}getPartitions(){if(!this.solved)throw new Error("Graph not solved");let partitions=[];for(let part of this.wipPartitions){if(part.pins.length===0)continue;let partBoxIds=new Set(part.pins.map(p4=>p4.boxId)),partBoxes=this.initialGraph.boxes.filter(b3=>partBoxIds.has(b3.boxId));partitions.push({boxes:partBoxes,pins:this.initialGraph.pins.filter(p4=>part.pins.some(pp3=>pp3.pinId===p4.pinId&&pp3.boxId===p4.boxId)||this.centerPinColors.includes(p4.color)&&partBoxIds.has(p4.boxId))})}return partitions}getGraphicsForLastGraph(){let graphics=getGraphicsForBpcGraph(this.lastGraph,{title:`Iteration ${this.iteration}`}),total=this.wipPartitions.length,PIN_RECT_SIZE=.4;if(this.wipPartitions.forEach((part,idx)=>{if(part.pins.length===0)return;let fill=getColorByIndex(idx,total,.25);for(let{boxId,pinId}of part.pins){let{x:x4,y:y4}=getPinPosition(this.lastGraph,boxId,pinId);graphics.rects.push({center:{x:x4,y:y4},width:PIN_RECT_SIZE,height:PIN_RECT_SIZE,fill})}}),this.lastExploredPin){let{boxId,pinId,color}=this.lastExploredPin,pos=getPinPosition(this.lastGraph,boxId,pinId),size3=.25;graphics.rects.push({center:{x:pos.x,y:pos.y},width:size3,height:size3,fill:this.lastExploredPin.partitionId?getColorByIndex(this.wipPartitions.findIndex(p4=>p4.partitionId===this.lastExploredPin.partitionId),this.wipPartitions.length,1):"black"}),graphics.texts.push({x:pos.x,y:pos.y,text:`${boxId}:${pinId}-${Array.from(this.boxSingletonKeys[boxId]??[]).join(",")}`,fontSize:.1})}let unexploredRectBaseSize=PIN_RECT_SIZE;for(let pin of this.unexploredPins){let{boxId,pinId,partitionId}=pin,partitionIdx=this.wipPartitions.findIndex(p4=>p4.partitionId===partitionId);if(partitionIdx===-1)continue;let stroke=getColorByIndex(partitionIdx,this.wipPartitions.length,1),{x:x4,y:y4}=getPinPosition(this.lastGraph,boxId,pinId),scale5=1+.1*partitionIdx;graphics.rects.push({center:{x:x4,y:y4},width:unexploredRectBaseSize*scale5,height:unexploredRectBaseSize*scale5,fill:"none",stroke})}return graphics}},matchGraph=(g6,corpus,opts={})=>{opts.similarityMethod??(opts.similarityMethod="wl-distance");let distanceFn=getBpcGraphWlDistance,corpusScores=Object.fromEntries(Object.entries(corpus).map(([k4,v4])=>[k4,distanceFn(g6,v4)])),bestMatch=Object.entries(corpusScores).reduce((best,[k4,d4])=>d4<best[1]?[k4,d4]:best);return{graphName:bestMatch[0],graph:corpus[bestMatch[0]],distance:bestMatch[1],corpusScores}},getDirectionFromVec2=vec2=>vec2.x>0?"x+":vec2.x<0?"x-":vec2.y>0?"y+":vec2.y<0?"y-":null,getDirectionVec2=direction2=>{switch(direction2){case"x+":return{x:1,y:0};case"x-":return{x:-1,y:0};case"y+":return{x:0,y:1};case"y-":return{x:0,y:-1}}},getDominantPinSide=(g6,boxId)=>{let box2=g6.boxes.find(b3=>b3.boxId===boxId);if(!box2)throw new Error(`Box ${boxId} not found`);let pinDirections=g6.pins.filter(p4=>p4.boxId===boxId).map(p4=>getPinDirection(g6,box2,p4)),sideCounts={"x-":0,"x+":0,"y-":0,"y+":0};for(let dir2 of pinDirections)dir2&&sideCounts[dir2]++;let maxSideCount=Math.max(...Object.values(sideCounts));for(let key of Object.keys(sideCounts))if(sideCounts[key]===maxSideCount)return key;return null},pushFloatingBoxesAdjustingForFixedSizeDelta=(adaptedFloatingBpcGraph,fixedGraph,{floatingToFixedBoxAssignment,floatingBoxIdsWithMutablePinOffsets})=>{for(let floatingBox of adaptedFloatingBpcGraph.boxes){let fixedBoxId=floatingToFixedBoxAssignment[floatingBox.boxId];if(!fixedBoxId||!floatingBox.center||floatingBoxIdsWithMutablePinOffsets?.has(floatingBox.boxId))continue;let fixedBoxBounds=getBoundsOfBpcBox(fixedGraph,fixedBoxId),floatingBoxBounds=getBoundsOfBpcBox(adaptedFloatingBpcGraph,floatingBox.boxId),fixedDominantPinSide=getDominantPinSide(fixedGraph,fixedBoxId),floatingDominantPinSide=getDominantPinSide(adaptedFloatingBpcGraph,floatingBox.boxId);if(fixedDominantPinSide===null||floatingDominantPinSide===null||fixedDominantPinSide!==floatingDominantPinSide)continue;let shiftVec=getDirectionVec2(fixedDominantPinSide),fixedWidth=fixedBoxBounds.maxX-fixedBoxBounds.minX,floatingWidth=floatingBoxBounds.maxX-floatingBoxBounds.minX,fixedHeight=fixedBoxBounds.maxY-fixedBoxBounds.minY,floatingHeight=floatingBoxBounds.maxY-floatingBoxBounds.minY,deltaWidth=floatingWidth-fixedWidth,deltaHeight=floatingHeight-fixedHeight;if(!(deltaWidth<.001&&deltaHeight<.001))for(let otherBox of adaptedFloatingBpcGraph.boxes){if(otherBox.boxId===floatingBox.boxId||!otherBox.center)continue;let deltaPos={x:otherBox.center.x-floatingBox.center.x,y:otherBox.center.y-floatingBox.center.y};getDirectionFromVec2({x:deltaPos.x*Math.abs(shiftVec.x),y:deltaPos.y*Math.abs(shiftVec.y)})===fixedDominantPinSide&&(otherBox.center.x+=shiftVec.x*deltaWidth,otherBox.center.y+=shiftVec.y*deltaHeight)}}},netAdaptBpcGraph2=(floatingGraph,fixedGraph,opts={})=>{let{floatingBoxIdsWithMutablePinOffsets=new Set}=opts,{floatingToFixedBoxAssignment,floatingToFixedPinAssignment}=getApproximateAssignments2(floatingGraph,fixedGraph),adaptedBpcGraph=structuredClone(floatingGraph);for(let floatingPin of adaptedBpcGraph.pins)if(floatingBoxIdsWithMutablePinOffsets.has(floatingPin.boxId)&&floatingToFixedPinAssignment[floatingPin.boxId]?.[floatingPin.pinId]){let fixedPinId=floatingToFixedPinAssignment[floatingPin.boxId]?.[floatingPin.pinId],fixedBoxId=floatingToFixedBoxAssignment[floatingPin.boxId],fixedPin=fixedGraph.pins.find(p4=>p4.boxId===fixedBoxId&&p4.pinId===fixedPinId);fixedPin&&(floatingPin.offset=fixedPin.offset)}for(let box2 of adaptedBpcGraph.boxes)if(floatingToFixedBoxAssignment[box2.boxId]){let fixedBoxId=floatingToFixedBoxAssignment[box2.boxId],fixedBox=fixedGraph.boxes.find(b3=>b3.boxId===fixedBoxId);fixedBox&&(box2.center=fixedBox.center,box2.kind="fixed")}return opts.pushBoxesAsBoxesChangeSize&&pushFloatingBoxesAdjustingForFixedSizeDelta(adaptedBpcGraph,fixedGraph,{floatingToFixedBoxAssignment,floatingBoxIdsWithMutablePinOffsets}),adaptedBpcGraph},layoutSchematicGraph=(g6,{corpus,singletonKeys,centerPinColors,floatingBoxIdsWithMutablePinOffsets})=>{let processor=new SchematicPartitionProcessor(g6,{singletonKeys,centerPinColors});for(;!processor.solved&&processor.iteration<1e3;)processor.step();let adaptedGraphs=processor.getPartitions().map(getCanonicalRightFacingGraph).map(part=>{let{graph:corpusSource,distance:distance8}=matchGraph(part.g,corpus);return{adaptedBpcGraph:netAdaptBpcGraph2(structuredClone(part.g),corpusSource,{floatingBoxIdsWithMutablePinOffsets,pushBoxesAsBoxesChangeSize:!0}),reflected:part.reflected,centerBoxId:part.centerBoxId,distance:distance8}}),adaptedUnreflectedGraphs=adaptedGraphs.map(({adaptedBpcGraph,reflected,centerBoxId})=>reflected?reflectGraph({graph:adaptedBpcGraph,axis:"x",centerBoxId}):adaptedBpcGraph),remergedGraph=mergeBoxSideSubgraphs(adaptedUnreflectedGraphs),totalDistance=adaptedGraphs.reduce((sum,ag2)=>sum+(ag2.distance||0),0);return{fixedGraph:remergedGraph,distance:totalDistance}},layoutSchematicGraphVariants=(variants,{corpus,singletonKeys,centerPinColors,floatingBoxIdsWithMutablePinOffsets})=>{let variantResults=[],bestVariant=null;for(let variant of variants){let{fixedGraph,distance:distance8}=layoutSchematicGraph(variant.floatingGraph,{corpus,singletonKeys,centerPinColors,floatingBoxIdsWithMutablePinOffsets});variantResults.push({variantName:variant.variantName,distance:distance8}),(!bestVariant||distance8<bestVariant.distance)&&(bestVariant={variantName:variant.variantName,result:fixedGraph,distance:distance8})}return{result:bestVariant.result,selectedVariantName:bestVariant.variantName,variantResults}};var import_debug13=__toESM(require_browser(),1);init_dist6();init_dist6();var BaseSolver4=class{constructor(){__publicField(this,"MAX_ITERATIONS",1e5);__publicField(this,"solved",!1);__publicField(this,"failed",!1);__publicField(this,"iterations",0);__publicField(this,"progress",0);__publicField(this,"error",null);__publicField(this,"activeSubSolver");__publicField(this,"failedSubSolvers");__publicField(this,"timeToSolve");__publicField(this,"stats",{})}step(){if(!this.solved&&!this.failed){this.iterations++;try{this._step()}catch(e5){throw this.error=`${this.constructor.name} error: ${e5}`,this.failed=!0,e5}!this.solved&&this.iterations>this.MAX_ITERATIONS&&this.tryFinalAcceptance(),!this.solved&&this.iterations>this.MAX_ITERATIONS&&(this.error=`${this.constructor.name} ran out of iterations`,this.failed=!0),"computeProgress"in this&&(this.progress=this.computeProgress())}}_step(){}getConstructorParams(){throw new Error("getConstructorParams not implemented")}solve(){let startTime=Date.now();for(;!this.solved&&!this.failed;)this.step();let endTime=Date.now();this.timeToSolve=endTime-startTime}visualize(){return{lines:[],points:[],rects:[],circles:[]}}tryFinalAcceptance(){}preview(){return{lines:[],points:[],rects:[],circles:[]}}};function rotatePoint3(point7,angleDegrees){let angleRad=angleDegrees*Math.PI/180,cos6=Math.cos(angleRad),sin6=Math.sin(angleRad);return{x:point7.x*cos6-point7.y*sin6,y:point7.x*sin6+point7.y*cos6}}function getRotatedDimensions(width,height,rotation5){let normalizedRotation=(rotation5%360+360)%360;return Math.round((normalizedRotation+90)%180)===0?{width:height,height:width}:{width,height}}function visualizeInputProblem(inputProblem,basicLayout){let inputViz={points:[],rects:[],lines:[],circles:[],texts:[]},pinToNetMap={};for(let conn of Object.keys(inputProblem.netConnMap)){let[pinId,netId]=conn.split("-");pinToNetMap[pinId]=netId}for(let[chipId,chip]of Object.entries(inputProblem.chipMap)){let chipPins=chip.pins.map(p4=>inputProblem.chipPinMap[p4]),placement=basicLayout.chipPlacements[chipId];if(!placement)continue;let width,height;if(chip.size&&Number.isFinite(chip.size.x)&&Number.isFinite(chip.size.y))width=chip.size.x,height=chip.size.y;else{let xs3=chipPins.map(p4=>p4.offset.x),ys3=chipPins.map(p4=>p4.offset.y),minX=xs3.length?Math.min(...xs3):-5,maxX=xs3.length?Math.max(...xs3):5,minY=ys3.length?Math.min(...ys3):-5,maxY=ys3.length?Math.max(...ys3):5;width=Math.max(10,maxX-minX+6),height=Math.max(10,maxY-minY+6)}let chipCenterX=placement.x,chipCenterY=placement.y,rotatedDims=getRotatedDimensions(width,height,placement.ccwRotationDegrees);inputViz.rects.push({center:{x:chipCenterX,y:chipCenterY},width:rotatedDims.width,height:rotatedDims.height,label:chipId}),inputViz.texts.push({x:chipCenterX,y:chipCenterY,text:chipId});for(let pin of chipPins){let rotatedOffset=rotatePoint3(pin.offset,placement.ccwRotationDegrees),pinAbsX=placement.x+rotatedOffset.x,pinAbsY=placement.y+rotatedOffset.y,netId=pinToNetMap[pin.pinId],label=netId?`${pin.pinId} (${netId})`:pin.pinId;inputViz.points.push({x:pinAbsX,y:pinAbsY,label})}}let netToPins={};for(let[pinId,netId]of Object.entries(pinToNetMap))netToPins[netId]||(netToPins[netId]=[]),netToPins[netId].push(pinId);for(let[,pinIds]of Object.entries(netToPins)){let pinPositions=pinIds.map(pinId=>{let chipPin=inputProblem.chipPinMap[pinId];if(chipPin){for(let[chipId,chip]of Object.entries(inputProblem.chipMap))if(chip.pins.includes(pinId)){let placement=basicLayout.chipPlacements[chipId];if(placement){let rotatedOffset=rotatePoint3(chipPin.offset,placement.ccwRotationDegrees);return{x:placement.x+rotatedOffset.x,y:placement.y+rotatedOffset.y}}}return chipPin.offset}return null}).filter(Boolean);for(let i3=0;i3<pinPositions.length;i3++)for(let j4=i3+1;j4<pinPositions.length;j4++)inputViz.lines.push({points:[pinPositions[i3],pinPositions[j4]],strokeColor:"rgba(0,0,0,0.1)"})}let getAbsolutePositionForPin=pinId=>{let chipPin=inputProblem.chipPinMap[pinId];if(chipPin){for(let[chipId,chip]of Object.entries(inputProblem.chipMap))if(chip.pins.includes(pinId)){let placement=basicLayout.chipPlacements[chipId];if(placement){let rotatedOffset=rotatePoint3(chipPin.offset,placement.ccwRotationDegrees);return{x:placement.x+rotatedOffset.x,y:placement.y+rotatedOffset.y}}}return chipPin.offset}return null},seenStrongConn=new Set;for(let[connKey,connected]of Object.entries(inputProblem.pinStrongConnMap)){if(!connected)continue;let[pinA,pinB]=connKey.split("-"),uniqueKey=pinA<pinB?`${pinA}-${pinB}`:`${pinB}-${pinA}`;if(seenStrongConn.has(uniqueKey))continue;seenStrongConn.add(uniqueKey);let p12=getAbsolutePositionForPin(pinA),p22=getAbsolutePositionForPin(pinB);!p12||!p22||inputViz.lines.push({points:[p12,p22]})}return inputViz}var hashInputProblem=inputProblem=>JSON.stringify(inputProblem),cachedProblems=new Map;function doBasicInputProblemLayout(inputProblem){let problemHash=hashInputProblem(inputProblem);if(cachedProblems.has(problemHash))return structuredClone(cachedProblems.get(problemHash));let components=Object.entries(inputProblem.chipMap).map(([chipId,chip])=>{let pads=chip.pins.map(pinId=>inputProblem.chipPinMap[pinId]).map(pin=>{let networkId=pin.pinId;for(let[connKey,connected]of Object.entries(inputProblem.pinStrongConnMap))if(connected&&connKey.includes(pin.pinId)){let[pin1Id,pin2Id]=connKey.split("-");if(pin1Id===pin.pinId||pin2Id===pin.pinId){networkId=[pin1Id,pin2Id].sort().join("_");break}}return{padId:pin.pinId,networkId,type:"rect",offset:pin.offset,size:{x:.001,y:.001}}});return pads.push({padId:`${chipId}-body`,networkId:chipId,type:"rect",offset:{x:0,y:0},size:{x:chip.size.x,y:chip.size.y}}),{componentId:chipId,pads}}),packResult=pack({components,minGap:.4,packOrderStrategy:"largest_to_smallest",packPlacementStrategy:"shortest_connection_along_outline"}),chipPlacements={};for(let component of packResult.components)chipPlacements[component.componentId]={x:component.center.x,y:component.center.y,ccwRotationDegrees:component.ccwRotationOffset};let outputLayout={chipPlacements,groupPlacements:{}};return cachedProblems.set(problemHash,outputLayout),structuredClone(outputLayout)}var ChipPartitionsSolver=class extends BaseSolver4{constructor({inputProblem,decouplingCapGroups}){super();__publicField(this,"inputProblem");__publicField(this,"partitions",[]);__publicField(this,"decouplingCapGroups");this.inputProblem=inputProblem,this.decouplingCapGroups=decouplingCapGroups}_step(){this.partitions=this.createPartitions(this.inputProblem),this.solved=!0}createPartitions(inputProblem){let chipIds=Object.keys(inputProblem.chipMap),decapChipIdSet=new Set,decapGroupPartitions=[];if(this.decouplingCapGroups&&this.decouplingCapGroups.length>0)for(let group of this.decouplingCapGroups){let capsOnly=[];for(let capId of group.decouplingCapChipIds)inputProblem.chipMap[capId]&&capsOnly.push(capId);if(capsOnly.length>=2){decapGroupPartitions.push(capsOnly);for(let capId of capsOnly)decapChipIdSet.add(capId)}}let nonDecapChipIds=chipIds.filter(id2=>!decapChipIdSet.has(id2)),adjacencyMap=new Map;for(let chipId of nonDecapChipIds)adjacencyMap.set(chipId,new Set);for(let[connKey,isConnected]of Object.entries(inputProblem.pinStrongConnMap)){if(!isConnected)continue;let[pin1Id,pin2Id]=connKey.split("-"),owner1=this.findPinOwner(pin1Id,inputProblem),owner2=this.findPinOwner(pin2Id,inputProblem);owner1&&owner2&&owner1!==owner2&&!decapChipIdSet.has(owner1)&&!decapChipIdSet.has(owner2)&&(adjacencyMap.get(owner1).add(owner2),adjacencyMap.get(owner2).add(owner1))}let visited=new Set,nonDecapPartitions=[];for(let componentId of nonDecapChipIds)if(!visited.has(componentId)){let partition=this.dfs(componentId,adjacencyMap,visited);partition.length>0&&nonDecapPartitions.push(partition)}return[...decapGroupPartitions.map(partition=>this.createInputProblemFromPartition(partition,inputProblem,{partitionType:"decoupling_caps"})),...nonDecapPartitions.map(partition=>this.createInputProblemFromPartition(partition,inputProblem))]}findPinOwner(pinId,inputProblem){if(inputProblem.chipPinMap[pinId]){for(let[chipId,chip]of Object.entries(inputProblem.chipMap))if(chip.pins.includes(pinId))return chipId}return null}dfs(startId,adjacencyMap,visited){let partition=[],stack=[startId];for(;stack.length>0;){let currentId=stack.pop();if(visited.has(currentId))continue;visited.add(currentId),partition.push(currentId);let neighbors=adjacencyMap.get(currentId)||new Set;for(let neighborId of neighbors)visited.has(neighborId)||stack.push(neighborId)}return partition}createInputProblemFromPartition(partition,originalProblem,opts){let chipIds=partition,relevantPinIds=new Set;for(let chipId of chipIds){let chip=originalProblem.chipMap[chipId];for(let pinId of chip.pins)relevantPinIds.add(pinId)}let chipMap={},chipPinMap={},netMap={},pinStrongConnMap={},netConnMap={};for(let chipId of chipIds)chipMap[chipId]=originalProblem.chipMap[chipId];for(let pinId of relevantPinIds)originalProblem.chipPinMap[pinId]&&(chipPinMap[pinId]=originalProblem.chipPinMap[pinId]);for(let[connKey,isConnected]of Object.entries(originalProblem.pinStrongConnMap)){let[pin1Id,pin2Id]=connKey.split("-");relevantPinIds.has(pin1Id)&&relevantPinIds.has(pin2Id)&&(pinStrongConnMap[connKey]=isConnected)}let relevantNetIds=new Set;for(let[connKey,isConnected]of Object.entries(originalProblem.netConnMap)){if(!isConnected)continue;let[pinId,netId]=connKey.split("-");relevantPinIds.has(pinId)&&(relevantNetIds.add(netId),netConnMap[connKey]=isConnected)}for(let netId of relevantNetIds)originalProblem.netMap[netId]&&(netMap[netId]=originalProblem.netMap[netId]);return{...originalProblem,chipMap,chipPinMap,netMap,pinStrongConnMap,netConnMap,isPartition:!0,partitionType:opts?.partitionType}}visualize(){if(this.partitions.length===0)return super.visualize();let partitionVisualizations=this.partitions.map(partition=>{let layout=doBasicInputProblemLayout(partition);return visualizeInputProblem(partition,layout)}),titles=this.partitions.map((_4,index)=>`partition${index}`);return stackGraphicsHorizontally(partitionVisualizations,{titles})}},getColorFromString=(string,alpha=1)=>{let hash=0;for(let i3=0;i3<string.length;i3++){let char=string.charCodeAt(i3);hash=(hash<<5)-hash+char,hash=hash&hash}return`hsl(${Math.abs(hash)%360}, 70%, 50%, ${alpha})`},IdentifyDecouplingCapsSolver=class extends BaseSolver4{constructor(inputProblem){super();__publicField(this,"inputProblem");__publicField(this,"queuedChips");__publicField(this,"outputDecouplingCapGroups",[]);__publicField(this,"groupsByMainChipId",new Map);__publicField(this,"lastChip",null);this.inputProblem=inputProblem,this.queuedChips=Object.values(inputProblem.chipMap)}isTwoPinRestrictedRotation(chip){if(chip.pins.length!==2||!chip.availableRotations)return!1;let allowed=new Set([0,180]);return chip.availableRotations.length>0&&chip.availableRotations.every(r5=>allowed.has(r5))}pinsOnOppositeYSides(chip){if(chip.pins.length!==2)return!1;let[p12,p22]=chip.pins,cp1=this.inputProblem.chipPinMap[p12],cp2=this.inputProblem.chipPinMap[p22];if(!cp1||!cp2)return!1;let sides=new Set([cp1.side,cp2.side]);return sides.has("y+")&&sides.has("y-")}getStronglyConnectedNeighborChips(pinId){let neighbors=new Set;for(let[connKey,connected]of Object.entries(this.inputProblem.pinStrongConnMap)){if(!connected)continue;let[a3,b3]=connKey.split("-");if(a3===pinId){let otherChipId=b3.split(".")[0];neighbors.add(otherChipId)}else if(b3===pinId){let otherChipId=a3.split(".")[0];neighbors.add(otherChipId)}}return neighbors}findMainChipIdForCap(capChip){let strongNeighbors=new Map;for(let pinId of capChip.pins){let neighbors=this.getStronglyConnectedNeighborChips(pinId);for(let n4 of neighbors)n4!==capChip.chipId&&strongNeighbors.set(n4,(strongNeighbors.get(n4)||0)+1)}if(strongNeighbors.size===0)return null;let best=null;for(let[id2,score]of strongNeighbors.entries())(!best||score>best.score||score===best.score&&id2<best.id)&&(best={id:id2,score});return best?best.id:null}getNetIdsForPin(pinId){let nets=new Set;for(let[connKey,connected]of Object.entries(this.inputProblem.netConnMap)){if(!connected)continue;let[p4,n4]=connKey.split("-");p4===pinId&&nets.add(n4)}return nets}getNormalizedNetPair(capChip){if(capChip.pins.length!==2)return null;let nets=new Set;for(let pinId of capChip.pins){let pinNets=this.getNetIdsForPin(pinId);for(let n4 of pinNets)nets.add(n4)}if(nets.size!==2)return null;let[a3,b3]=Array.from(nets).sort();return[a3,b3]}addToGroup(mainChipId,netPair,capChipId){let[n12,n22]=netPair,groupKey=`${mainChipId}__${n12}__${n22}`,group=this.groupsByMainChipId.get(groupKey);group||(group={decouplingCapGroupId:`decap_group_${mainChipId}__${n12}__${n22}`,mainChipId,netPair:[n12,n22],decouplingCapChipIds:[]},this.groupsByMainChipId.set(groupKey,group),this.outputDecouplingCapGroups.push(group)),group.decouplingCapChipIds.includes(capChipId)||group.decouplingCapChipIds.push(capChipId)}_step(){let currentChip=this.queuedChips.shift();if(this.lastChip=currentChip??null,!currentChip){this.solved=!0;return}if(!(this.isTwoPinRestrictedRotation(currentChip)&&this.pinsOnOppositeYSides(currentChip)))return;let mainChipId=this.findMainChipIdForCap(currentChip);if(!mainChipId)return;let netPair=this.getNormalizedNetPair(currentChip);if(!netPair)return;let[n12,n22]=netPair,net1=this.inputProblem.netMap[n12],net2=this.inputProblem.netMap[n22];(net1?.isGround&&net2?.isPositiveVoltageSource||net2?.isGround&&net1?.isPositiveVoltageSource)&&this.addToGroup(mainChipId,netPair,currentChip.chipId)}visualize(){let basicLayout=doBasicInputProblemLayout(this.inputProblem),graphics=visualizeInputProblem(this.inputProblem,basicLayout),chipDecapGroupMap=new Map;for(let group of this.outputDecouplingCapGroups){chipDecapGroupMap.set(group.mainChipId,group);for(let capChipId of group.decouplingCapChipIds)chipDecapGroupMap.set(capChipId,group)}for(let rect of graphics.rects||[])rect.label!==this.lastChip?.chipId&&(rect.fill="rgba(0,0,0,0.5)");for(let rect of graphics.rects||[]){let chipId=rect.label,group=chipDecapGroupMap.get(chipId);group&&(rect.label=`${rect.label}
|
|
648
649
|
${group.decouplingCapGroupId}`,rect.fill=getColorFromString(group.decouplingCapGroupId,.8))}return graphics}getConstructorParams(){return[this.inputProblem]}computeProgress(){let total=Object.keys(this.inputProblem.chipMap).length||1,processed=total-this.queuedChips.length;return Math.min(1,Math.max(0,processed/total))}};function createFilteredNetworkMapping(params){let{inputProblem,pinIdToStronglyConnectedPins}=params,pinToNetworkMap=new Map,filteredPins=new Set,hasStrongConnections=!1,strongConnectedChipSides=new Map;for(let[connKey,connected]of Object.entries(inputProblem.pinStrongConnMap)){if(!connected)continue;hasStrongConnections=!0;let pins=connKey.split("-");if(pins.length===2&&pins[0]&&pins[1]){let pin1=inputProblem.chipPinMap[pins[0]],pin2=inputProblem.chipPinMap[pins[1]];if(pin1&&pin2){let chip1Id=pins[0].split(".")[0],chip2Id=pins[1].split(".")[0];if(chip1Id&&chip2Id&&chip1Id!==chip2Id){let key1=`${chip1Id}-${chip2Id}`,key2=`${chip2Id}-${chip1Id}`;strongConnectedChipSides.has(key1)||strongConnectedChipSides.set(key1,new Set),strongConnectedChipSides.has(key2)||strongConnectedChipSides.set(key2,new Set),strongConnectedChipSides.get(key1).add(pin1.side),strongConnectedChipSides.get(key2).add(pin2.side)}}}}if(hasStrongConnections)for(let[connKey,connected]of Object.entries(inputProblem.netConnMap)){if(!connected)continue;let[pinId,netId]=connKey.split("-");pinId&&netId&&filteredPins.add(pinId)}else for(let[connKey,connected]of Object.entries(inputProblem.netConnMap)){if(!connected)continue;let[pinId,netId]=connKey.split("-");if(pinId&&netId){if(!inputProblem.chipPinMap[pinId])continue;let chipId=pinId.split(".")[0],shouldIncludeInNetwork=!0;for(let[strongKey,strongSides]of strongConnectedChipSides.entries()){let[fromChip,toChip]=strongKey.split("-");if(fromChip===chipId)for(let[otherConnKey,otherConnected]of Object.entries(inputProblem.netConnMap)){if(!otherConnected)continue;let[otherPinId,otherNetId]=otherConnKey.split("-");if(otherNetId===netId&&otherPinId&&otherPinId!==pinId){let otherPin=inputProblem.chipPinMap[otherPinId];if(!otherPin)continue;if(otherPinId.split(".")[0]===toChip&&!strongSides.has(otherPin.side)){shouldIncludeInNetwork=!1;break}}}}if(shouldIncludeInNetwork)pinToNetworkMap.set(pinId,netId);else{let disconnectedNetworkId=`${pinId}_opposite-strong-side-disconnected`;pinToNetworkMap.set(pinId,disconnectedNetworkId),filteredPins.add(pinId)}}}for(let[connKey,connected]of Object.entries(inputProblem.pinStrongConnMap)){if(!connected)continue;let pins=connKey.split("-");if(pins.length===2&&pins[0]&&pins[1]){let existingNet=pinToNetworkMap.get(pins[0])||pinToNetworkMap.get(pins[1]);existingNet?(pinToNetworkMap.set(pins[0],existingNet),pinToNetworkMap.set(pins[1],existingNet)):(pinToNetworkMap.set(pins[0],connKey),pinToNetworkMap.set(pins[1],connKey))}}return{pinToNetworkMap,filteredPins}}var getPadsBoundingBox=pads=>{let xs3=pads.flatMap(p4=>[p4.offset.x-p4.size.x/2,p4.offset.x+p4.size.x/2]),ys3=pads.flatMap(p4=>[p4.offset.y-p4.size.y/2,p4.offset.y+p4.size.y/2]),minX=xs3.length?Math.min(...xs3):0,maxX=xs3.length?Math.max(...xs3):0,minY=ys3.length?Math.min(...ys3):0,maxY=ys3.length?Math.max(...ys3):0;return{minX,maxX,minY,maxY}},PIN_SIZE=.1,SingleInnerPartitionPackingSolver=class extends BaseSolver4{constructor(params){super();__publicField(this,"partitionInputProblem");__publicField(this,"layout",null);__publicField(this,"pinIdToStronglyConnectedPins");this.partitionInputProblem=params.partitionInputProblem,this.pinIdToStronglyConnectedPins=params.pinIdToStronglyConnectedPins}_step(){if(!this.activeSubSolver){let packInput=this.createPackInput();this.activeSubSolver=new PackSolver2(packInput),this.activeSubSolver=this.activeSubSolver}if(this.activeSubSolver.step(),this.activeSubSolver.failed){this.failed=!0,this.error=`PackSolver2 failed: ${this.activeSubSolver.error}`;return}this.activeSubSolver.solved&&(this.layout=this.createLayoutFromPackingResult(this.activeSubSolver.packedComponents),this.solved=!0,this.activeSubSolver=null)}createPackInput(){let pinToNetworkMap=createFilteredNetworkMapping({inputProblem:this.partitionInputProblem,pinIdToStronglyConnectedPins:this.pinIdToStronglyConnectedPins}).pinToNetworkMap,packComponents=Object.entries(this.partitionInputProblem.chipMap).map(([chipId,chip])=>{let pads=[];for(let pinId of chip.pins){let pin=this.partitionInputProblem.chipPinMap[pinId];if(!pin)continue;let networkId=pinToNetworkMap.get(pinId)||`${pinId}_isolated`;pads.push({padId:pinId,networkId,type:"rect",offset:{x:pin.offset.x,y:pin.offset.y},size:{x:PIN_SIZE,y:PIN_SIZE}})}let padsBoundingBox=getPadsBoundingBox(pads),padsBoundingBoxSize={x:padsBoundingBox.maxX-padsBoundingBox.minX,y:padsBoundingBox.maxY-padsBoundingBox.minY};return pads.push({padId:`${chipId}_body`,networkId:`${chipId}_body_disconnected`,type:"rect",offset:{x:0,y:0},size:{x:Math.max(padsBoundingBoxSize.x,chip.size.x),y:Math.max(padsBoundingBoxSize.y,chip.size.y)}}),{componentId:chipId,pads,availableRotationDegrees:chip.availableRotations||[0,90,180,270]}}),minGap=this.partitionInputProblem.chipGap;return this.partitionInputProblem.partitionType==="decoupling_caps"&&(minGap=this.partitionInputProblem.decouplingCapsGap??minGap),{components:packComponents,minGap,packOrderStrategy:"largest_to_smallest",packPlacementStrategy:"minimum_closest_sum_squared_distance"}}createLayoutFromPackingResult(packedComponents){let chipPlacements={};for(let packedComponent of packedComponents){let chipId=packedComponent.componentId;chipPlacements[chipId]={x:packedComponent.center.x,y:packedComponent.center.y,ccwRotationDegrees:packedComponent.ccwRotationOffset||packedComponent.ccwRotationDegrees||0}}return{chipPlacements,groupPlacements:{}}}visualize(){if(this.activeSubSolver&&!this.solved)return this.activeSubSolver.visualize();if(!this.layout){let basicLayout=doBasicInputProblemLayout(this.partitionInputProblem);return visualizeInputProblem(this.partitionInputProblem,basicLayout)}return visualizeInputProblem(this.partitionInputProblem,this.layout)}getConstructorParams(){return[this.partitionInputProblem]}},PackInnerPartitionsSolver=class extends BaseSolver4{constructor(params){super();__publicField(this,"partitions");__publicField(this,"packedPartitions",[]);__publicField(this,"completedSolvers",[]);__publicField(this,"activeSolver",null);__publicField(this,"currentPartitionIndex",0);__publicField(this,"pinIdToStronglyConnectedPins");this.partitions=params.partitions,this.pinIdToStronglyConnectedPins=params.pinIdToStronglyConnectedPins}_step(){if(this.currentPartitionIndex>=this.partitions.length){this.solved=!0;return}if(!this.activeSolver){let currentPartition=this.partitions[this.currentPartitionIndex];this.activeSolver=new SingleInnerPartitionPackingSolver({partitionInputProblem:currentPartition,pinIdToStronglyConnectedPins:this.pinIdToStronglyConnectedPins}),this.activeSubSolver=this.activeSolver}if(this.activeSolver.step(),this.activeSolver.failed){this.failed=!0,this.error=`Partition ${this.currentPartitionIndex} failed: ${this.activeSolver.error}`;return}if(this.activeSolver.solved){if(this.completedSolvers.push(this.activeSolver),this.activeSolver.layout)this.packedPartitions.push({inputProblem:this.partitions[this.currentPartitionIndex],layout:this.activeSolver.layout});else{this.failed=!0,this.error=`Partition ${this.currentPartitionIndex} completed but has no layout`;return}this.activeSolver=null,this.activeSubSolver=null,this.currentPartitionIndex++}}visualize(){if(this.activeSolver)return this.activeSolver.visualize();if(this.completedSolvers.length===0)return super.visualize();let partitionVisualizations=this.completedSolvers.map(solver=>solver.visualize()),titles=this.completedSolvers.map((_4,index)=>`packed_partition_${index}`);return stackGraphicsHorizontally(partitionVisualizations,{titles})}getConstructorParams(){return[this.partitions]}},PartitionPackingSolver=class extends BaseSolver4{constructor(input2){super();__publicField(this,"packedPartitions");__publicField(this,"inputProblem");__publicField(this,"finalLayout",null);__publicField(this,"packSolver2",null);this.packedPartitions=input2.packedPartitions,this.inputProblem=input2.inputProblem}_step(){try{if(this.packedPartitions.length===0){this.finalLayout={chipPlacements:{},groupPlacements:{}},this.solved=!0;return}if(this.packedPartitions.length===1){this.finalLayout=this.packedPartitions[0].layout,this.solved=!0;return}let partitionGroups=this.organizePackedPartitions();if(!this.packSolver2){let packInput=this.createPackInput(partitionGroups);this.packSolver2=new PackSolver2(packInput),this.activeSubSolver=this.packSolver2}if(this.packSolver2.step(),this.packSolver2.failed){this.failed=!0,this.error=`PackSolver2 failed: ${this.packSolver2.error}`;return}if(this.packSolver2.solved){let packedLayout=this.applyPackingResult(this.packSolver2.packedComponents,partitionGroups);this.finalLayout=packedLayout,this.solved=!0,this.activeSubSolver=null}}catch(error2){this.failed=!0,this.error=`Failed to pack partitions: ${error2}`}}organizePackedPartitions(){let partitionGroups=[];for(let i3=0;i3<this.packedPartitions.length;i3++){let packedPartition=this.packedPartitions[i3],partitionChipIds=Object.keys(packedPartition.layout.chipPlacements);if(partitionChipIds.length>0){let minX=1/0,maxX=-1/0,minY=1/0,maxY=-1/0;for(let chipId of partitionChipIds){let placement=packedPartition.layout.chipPlacements[chipId],chip=packedPartition.inputProblem.chipMap[chipId],chipWidth=chip.size.x,chipHeight=chip.size.y;(placement.ccwRotationDegrees===90||placement.ccwRotationDegrees===270)&&([chipWidth,chipHeight]=[chipHeight,chipWidth]);let chipMinX=placement.x-chipWidth/2,chipMaxX=placement.x+chipWidth/2,chipMinY=placement.y-chipHeight/2,chipMaxY=placement.y+chipHeight/2;minX=Math.min(minX,chipMinX),maxX=Math.max(maxX,chipMaxX),minY=Math.min(minY,chipMinY),maxY=Math.max(maxY,chipMaxY)}let bounds={minX,maxX,minY,maxY};partitionGroups.push({partitionIndex:i3,chipIds:partitionChipIds,bounds})}}return partitionGroups}createPackInput(partitionGroups){let pinToNetworkMap=new Map;for(let packedPartition of this.packedPartitions){for(let[connKey,connected]of Object.entries(packedPartition.inputProblem.netConnMap)){if(!connected)continue;let[pinId,netId]=connKey.split("-");pinId&&netId&&pinToNetworkMap.set(pinId,netId)}for(let[connKey,connected]of Object.entries(packedPartition.inputProblem.pinStrongConnMap)){if(!connected)continue;let pins=connKey.split("-");if(pins.length===2&&pins[0]&&pins[1]){let existingNet=pinToNetworkMap.get(pins[0])||pinToNetworkMap.get(pins[1]);existingNet?(pinToNetworkMap.set(pins[0],existingNet),pinToNetworkMap.set(pins[1],existingNet)):(pinToNetworkMap.set(pins[0],connKey),pinToNetworkMap.set(pins[1],connKey))}}}return{components:partitionGroups.map(group=>{let packedPartition=this.packedPartitions[group.partitionIndex],partitionWidth=group.bounds.maxX-group.bounds.minX,partitionHeight=group.bounds.maxY-group.bounds.minY,centerX=(group.bounds.minX+group.bounds.maxX)/2,centerY=(group.bounds.minY+group.bounds.maxY)/2,pads=[{padId:`partition_${group.partitionIndex}_body`,networkId:`partition_${group.partitionIndex}_disconnected`,type:"rect",offset:{x:0,y:0},size:{x:Math.max(partitionWidth,.1),y:Math.max(partitionHeight,.1)}}],addedNetworks=new Set,pinPositions=new Map;for(let chipId of group.chipIds){let chipPlacement=packedPartition.layout.chipPlacements[chipId],chip=packedPartition.inputProblem.chipMap[chipId];for(let pinId of chip.pins){let chipPin=packedPartition.inputProblem.chipPinMap[pinId];if(!chipPin)continue;let transformedOffset={x:chipPin.offset.x,y:chipPin.offset.y},rotation5=chipPlacement.ccwRotationDegrees||0;rotation5===90?transformedOffset={x:-chipPin.offset.y,y:chipPin.offset.x}:rotation5===180?transformedOffset={x:-chipPin.offset.x,y:-chipPin.offset.y}:rotation5===270&&(transformedOffset={x:chipPin.offset.y,y:-chipPin.offset.x});let absolutePinX=chipPlacement.x+transformedOffset.x,absolutePinY=chipPlacement.y+transformedOffset.y;pinPositions.set(pinId,{x:absolutePinX,y:absolutePinY});let networkId=pinToNetworkMap.get(pinId)||`${pinId}_disconnected`;if(!addedNetworks.has(networkId)){addedNetworks.add(networkId);let padOffsetX=absolutePinX-centerX,padOffsetY=absolutePinY-centerY;pads.push({padId:`${group.partitionIndex}_pin_${pinId}`,networkId,type:"rect",offset:{x:padOffsetX,y:padOffsetY},size:{x:.01,y:.01}})}}}return{componentId:`partition_${group.partitionIndex}`,pads,availableRotationDegrees:[0]}}),minGap:this.inputProblem.partitionGap,packOrderStrategy:"largest_to_smallest",packPlacementStrategy:"minimum_sum_squared_distance_to_network"}}applyPackingResult(packedComponents,partitionGroups){let newChipPlacements={};for(let packedComponent of packedComponents){let partitionIndex=parseInt(packedComponent.componentId.replace("partition_","")),group=partitionGroups.find(g6=>g6.partitionIndex===partitionIndex),packedPartition=this.packedPartitions[partitionIndex];if(group&&packedPartition){let currentCenterX=(group.bounds.minX+group.bounds.maxX)/2,currentCenterY=(group.bounds.minY+group.bounds.maxY)/2,newCenterX=packedComponent.center.x,newCenterY=packedComponent.center.y,offsetX=newCenterX-currentCenterX,offsetY=newCenterY-currentCenterY;for(let chipId of group.chipIds){let originalPlacement=packedPartition.layout.chipPlacements[chipId];newChipPlacements[chipId]={x:originalPlacement.x+offsetX,y:originalPlacement.y+offsetY,ccwRotationDegrees:originalPlacement.ccwRotationDegrees}}}}return{chipPlacements:newChipPlacements,groupPlacements:{}}}visualize(){if(this.packSolver2&&!this.solved)return this.packSolver2.visualize();if(!this.finalLayout)return super.visualize();let combinedProblem={chipMap:{},chipPinMap:{},pinStrongConnMap:{},netMap:{},netConnMap:{},chipGap:this.inputProblem.chipGap,partitionGap:this.inputProblem.partitionGap};for(let packedPartition of this.packedPartitions)Object.assign(combinedProblem.chipMap,packedPartition.inputProblem.chipMap),Object.assign(combinedProblem.chipPinMap,packedPartition.inputProblem.chipPinMap),Object.assign(combinedProblem.pinStrongConnMap,packedPartition.inputProblem.pinStrongConnMap),Object.assign(combinedProblem.netMap,packedPartition.inputProblem.netMap),Object.assign(combinedProblem.netConnMap,packedPartition.inputProblem.netConnMap);return visualizeInputProblem(combinedProblem,this.finalLayout)}getConstructorParams(){return{packedPartitions:this.packedPartitions,inputProblem:this.inputProblem}}},getPinIdToStronglyConnectedPinsObj=inputProblem=>{let pinIdToStronglyConnectedPins={},pinIds=Object.keys(inputProblem.chipPinMap);for(let i3=0;i3<pinIds.length;i3++)for(let j4=i3+1;j4<pinIds.length;j4++){let pinId1=pinIds[i3],pinId2=pinIds[j4];(inputProblem.pinStrongConnMap[`${pinId1}-${pinId2}`]||inputProblem.pinStrongConnMap[`${pinId2}-${pinId1}`])&&(pinIdToStronglyConnectedPins[pinId1]??(pinIdToStronglyConnectedPins[pinId1]=[]),pinIdToStronglyConnectedPins[pinId2]??(pinIdToStronglyConnectedPins[pinId2]=[]),pinIdToStronglyConnectedPins[pinId1].push(inputProblem.chipPinMap[pinId2]),pinIdToStronglyConnectedPins[pinId2].push(inputProblem.chipPinMap[pinId1]))}return pinIdToStronglyConnectedPins};function definePipelineStep(solverName,solverClass,getConstructorParams,opts={}){return{solverName,solverClass,getConstructorParams,onSolved:opts.onSolved}}var LayoutPipelineSolver=class extends BaseSolver4{constructor(inputProblem){super();__publicField(this,"identifyDecouplingCapsSolver");__publicField(this,"chipPartitionsSolver");__publicField(this,"packInnerPartitionsSolver");__publicField(this,"partitionPackingSolver");__publicField(this,"startTimeOfPhase");__publicField(this,"endTimeOfPhase");__publicField(this,"timeSpentOnPhase");__publicField(this,"firstIterationOfPhase");__publicField(this,"pinIdToStronglyConnectedPins");__publicField(this,"inputProblem");__publicField(this,"chipPartitions");__publicField(this,"packedPartitions");__publicField(this,"pipelineDef",[definePipelineStep("identifyDecouplingCapsSolver",IdentifyDecouplingCapsSolver,()=>[this.inputProblem],{onSolved:_layoutSolver=>{}}),definePipelineStep("chipPartitionsSolver",ChipPartitionsSolver,()=>[{inputProblem:this.inputProblem,decouplingCapGroups:this.identifyDecouplingCapsSolver?.outputDecouplingCapGroups}],{onSolved:_layoutSolver=>{this.chipPartitions=this.chipPartitionsSolver.partitions}}),definePipelineStep("packInnerPartitionsSolver",PackInnerPartitionsSolver,()=>[{partitions:this.chipPartitions,pinIdToStronglyConnectedPins:this.pinIdToStronglyConnectedPins}],{onSolved:_solver=>{this.packedPartitions=this.packInnerPartitionsSolver.packedPartitions}}),definePipelineStep("partitionPackingSolver",PartitionPackingSolver,()=>[{packedPartitions:this.packedPartitions||[],inputProblem:this.inputProblem}],{onSolved:_solver=>{}})]);__publicField(this,"currentPipelineStepIndex",0);this.inputProblem=inputProblem,this.MAX_ITERATIONS=1e6,this.startTimeOfPhase={},this.endTimeOfPhase={},this.timeSpentOnPhase={},this.firstIterationOfPhase={},this.pinIdToStronglyConnectedPins=getPinIdToStronglyConnectedPinsObj(inputProblem)}_step(){let pipelineStepDef=this.pipelineDef[this.currentPipelineStepIndex];if(!pipelineStepDef){this.solved=!0;return}if(this.activeSubSolver){this.activeSubSolver.step(),this.activeSubSolver.solved?(this.endTimeOfPhase[pipelineStepDef.solverName]=performance.now(),this.timeSpentOnPhase[pipelineStepDef.solverName]=this.endTimeOfPhase[pipelineStepDef.solverName]-this.startTimeOfPhase[pipelineStepDef.solverName],pipelineStepDef.onSolved?.(this),this.activeSubSolver=null,this.currentPipelineStepIndex++):this.activeSubSolver.failed&&(this.error=this.activeSubSolver?.error,this.failed=!0,this.activeSubSolver=null);return}let constructorParams=pipelineStepDef.getConstructorParams(this);this.activeSubSolver=new pipelineStepDef.solverClass(...constructorParams),this[pipelineStepDef.solverName]=this.activeSubSolver,this.timeSpentOnPhase[pipelineStepDef.solverName]=0,this.startTimeOfPhase[pipelineStepDef.solverName]=performance.now(),this.firstIterationOfPhase[pipelineStepDef.solverName]=this.iterations}solveUntilPhase(phase){for(;this.getCurrentPhase()!==phase;)this.step()}getCurrentPhase(){return this.pipelineDef[this.currentPipelineStepIndex]?.solverName??"none"}visualize(){if(!this.solved&&this.activeSubSolver)return this.activeSubSolver.visualize();if(this.solved&&this.partitionPackingSolver?.solved)return this.partitionPackingSolver.visualize();let identifyDecouplingCapsViz=this.identifyDecouplingCapsSolver?.visualize(),chipPartitionsViz=this.chipPartitionsSolver?.visualize(),packInnerPartitionsViz=this.packInnerPartitionsSolver?.visualize(),partitionPackingViz=this.partitionPackingSolver?.visualize(),basicLayout=doBasicInputProblemLayout(this.inputProblem),visualizations=[visualizeInputProblem(this.inputProblem,basicLayout),identifyDecouplingCapsViz,chipPartitionsViz,packInnerPartitionsViz,partitionPackingViz].filter(Boolean).map((viz,stepIndex)=>{for(let rect of viz.rects??[])rect.step=stepIndex;for(let point7 of viz.points??[])point7.step=stepIndex;for(let circle2 of viz.circles??[])circle2.step=stepIndex;for(let text of viz.texts??[])text.step=stepIndex;for(let line2 of viz.lines??[])line2.step=stepIndex;return viz});return visualizations.length===1?visualizations[0]:{points:visualizations.flatMap(v4=>v4.points||[]),rects:visualizations.flatMap(v4=>v4.rects||[]),lines:visualizations.flatMap(v4=>v4.lines||[]),circles:visualizations.flatMap(v4=>v4.circles||[]),texts:visualizations.flatMap(v4=>v4.texts||[])}}preview(){return this.activeSubSolver?this.activeSubSolver.preview():this.partitionPackingSolver?.solved?this.partitionPackingSolver.visualize():this.packInnerPartitionsSolver?.solved?this.packInnerPartitionsSolver.visualize():this.chipPartitionsSolver?.solved?this.chipPartitionsSolver.visualize():this.identifyDecouplingCapsSolver?.solved?this.identifyDecouplingCapsSolver.visualize():super.preview()}checkForOverlaps(layout){let overlaps=[],chipIds=Object.keys(layout.chipPlacements);for(let i3=0;i3<chipIds.length;i3++)for(let j4=i3+1;j4<chipIds.length;j4++){let chip1Id=chipIds[i3],chip2Id=chipIds[j4],placement1=layout.chipPlacements[chip1Id],placement2=layout.chipPlacements[chip2Id],chip1=this.inputProblem.chipMap[chip1Id],chip2=this.inputProblem.chipMap[chip2Id];if(!chip1||!chip2)continue;let bounds1=this.getRotatedBounds(placement1,chip1.size),bounds2=this.getRotatedBounds(placement2,chip2.size),overlapArea=this.calculateOverlapArea(bounds1,bounds2);overlapArea>0&&overlaps.push({chip1:chip1Id,chip2:chip2Id,overlapArea})}return overlaps}getRotatedBounds(placement,size3){let halfWidth=size3.x/2,halfHeight=size3.y/2,angleRad=placement.ccwRotationDegrees*Math.PI/180,cos6=Math.abs(Math.cos(angleRad)),sin6=Math.abs(Math.sin(angleRad)),rotatedWidth=halfWidth*cos6+halfHeight*sin6,rotatedHeight=halfWidth*sin6+halfHeight*cos6;return{minX:placement.x-rotatedWidth,maxX:placement.x+rotatedWidth,minY:placement.y-rotatedHeight,maxY:placement.y+rotatedHeight}}calculateOverlapArea(bounds1,bounds2){if(bounds1.maxX<=bounds2.minX||bounds1.minX>=bounds2.maxX||bounds1.maxY<=bounds2.minY||bounds1.minY>=bounds2.maxY)return 0;let overlapWidth=Math.min(bounds1.maxX,bounds2.maxX)-Math.max(bounds1.minX,bounds2.minX),overlapHeight=Math.min(bounds1.maxY,bounds2.maxY)-Math.max(bounds1.minY,bounds2.minY);return overlapWidth*overlapHeight}getOutputLayout(){if(!this.solved)throw new Error("Pipeline not solved yet. Call solve() or step() until solved.");let finalLayout;if(this.partitionPackingSolver?.solved&&this.partitionPackingSolver.finalLayout)finalLayout=this.partitionPackingSolver.finalLayout;else throw new Error("No layout available. Pipeline may have failed or not progressed far enough.");let overlaps=this.checkForOverlaps(finalLayout);if(overlaps.length>0){let overlapDetails=overlaps.map(overlap=>`${overlap.chip1} overlaps ${overlap.chip2} (area: ${overlap.overlapArea.toFixed(4)})`).join(", ");console.warn(`Warning: ${overlaps.length} chip overlaps detected in final layout: ${overlapDetails}`)}return finalLayout}};var import_debug14=__toESM(require_browser(),1);var ConnectivityMap2=class{constructor(netMap){__publicField(this,"netMap");__publicField(this,"idToNetMap");this.netMap=netMap,this.idToNetMap={};for(let[netId,ids]of Object.entries(netMap))for(let id2 of ids)this.idToNetMap[id2]=netId}addConnections(connections){for(let connection of connections){let existingNets=new Set;for(let id2 of connection){let existingNetId=this.idToNetMap[id2];existingNetId&&existingNets.add(existingNetId)}let targetNetId;if(existingNets.size===0)targetNetId=`connectivity_net${Object.keys(this.netMap).length}`,this.netMap[targetNetId]=[];else if(existingNets.size===1)targetNetId=existingNets.values().next().value??`connectivity_net${Object.keys(this.netMap).length}`;else{targetNetId=existingNets.values().next().value??`connectivity_net${Object.keys(this.netMap).length}`;for(let netId of existingNets)if(netId!==targetNetId){let targetNet=this.netMap[targetNetId],sourceNet=this.netMap[netId];if(targetNet&&sourceNet){targetNet.push(...sourceNet),this.netMap[netId]=targetNet;for(let id2 of targetNet)this.idToNetMap[id2]=targetNetId}}}for(let id2 of connection){let targetNet=this.netMap[targetNetId];targetNet&&!targetNet.includes(id2)&&targetNet.push(id2),this.idToNetMap[id2]=targetNetId}}}getIdsConnectedToNet(netId){return this.netMap[netId]||[]}getNetConnectedToId(id2){return this.idToNetMap[id2]}areIdsConnected(id1,id2){if(id1===id2)return!0;let netId1=this.getNetConnectedToId(id1);if(!netId1)return!1;let netId2=this.getNetConnectedToId(id2);return netId2?netId1===netId2||netId2===id1||netId2===id1:!1}areAllIdsConnected(ids){if(ids.length===0)return!0;let netId=this.getNetConnectedToId(ids[0]);if(!netId)return!1;for(let id2 of ids){let nextNetId=this.getNetConnectedToId(id2);if(nextNetId===void 0||nextNetId!==netId)return!1}return!0}};init_dist5();var BaseSolver5=class{constructor(){__publicField(this,"MAX_ITERATIONS",1e5);__publicField(this,"solved",!1);__publicField(this,"failed",!1);__publicField(this,"iterations",0);__publicField(this,"progress",0);__publicField(this,"error",null);__publicField(this,"activeSubSolver");__publicField(this,"failedSubSolvers");__publicField(this,"timeToSolve");__publicField(this,"stats",{})}step(){if(!this.solved&&!this.failed){this.iterations++;try{this._step()}catch(e5){throw this.error=`${this.constructor.name} error: ${e5}`,this.failed=!0,e5}!this.solved&&this.iterations>this.MAX_ITERATIONS&&this.tryFinalAcceptance(),!this.solved&&this.iterations>this.MAX_ITERATIONS&&(this.error=`${this.constructor.name} ran out of iterations`,this.failed=!0),"computeProgress"in this&&(this.progress=this.computeProgress())}}_step(){}getConstructorParams(){throw new Error("getConstructorParams not implemented")}solve(){let startTime=Date.now();for(;!this.solved&&!this.failed;)this.step();let endTime=Date.now();this.timeToSolve=endTime-startTime}visualize(){return{lines:[],points:[],rects:[],circles:[]}}tryFinalAcceptance(){}preview(){return{lines:[],points:[],rects:[],circles:[]}}},getConnectivityMapsFromInputProblem=inputProblem=>{let directConnMap=new ConnectivityMap2({});for(let directConn of inputProblem.directConnections)directConnMap.addConnections([directConn.netId?[directConn.netId,...directConn.pinIds]:directConn.pinIds]);let netConnMap=new ConnectivityMap2(directConnMap.netMap);for(let netConn of inputProblem.netConnections)netConnMap.addConnections([[netConn.netId,...netConn.pinIds]]);return{directConnMap,netConnMap}};function getOrthogonalMinimumSpanningTree(pins,opts={}){let n4=pins.length,maxDistance=opts?.maxDistance??Number.POSITIVE_INFINITY;if(n4<=1)return[];{let seen=new Set;for(let p4 of pins){if(seen.has(p4.pinId))throw new Error(`Duplicate pinId detected: "${p4.pinId}"`);seen.add(p4.pinId)}}let manhattan=(a3,b3)=>Math.abs(a3.x-b3.x)+Math.abs(a3.y-b3.y),inTree=new Array(n4).fill(!1),bestDist=new Array(n4).fill(Number.POSITIVE_INFINITY),parent=new Array(n4).fill(-1),startIndex=0;for(let i3=1;i3<n4;i3++)pins[i3].pinId<pins[startIndex].pinId&&(startIndex=i3);bestDist[startIndex]=0;let edges=[];for(let iter=0;iter<n4;iter++){let u5=-1,best=Number.POSITIVE_INFINITY,bestId="";for(let i3=0;i3<n4;i3++)if(!inTree[i3]){let d4=bestDist[i3];(d4<best||d4===best&&(bestId===""||pins[i3].pinId<bestId))&&(best=d4,bestId=pins[i3].pinId,u5=i3)}inTree[u5]=!0,parent[u5]!==-1&&edges.push([pins[u5].pinId,pins[parent[u5]].pinId]);for(let v4=0;v4<n4;v4++)if(!inTree[v4]){let d02=manhattan(pins[u5],pins[v4]),isForbidden=opts?.forbidEdge?.(pins[u5],pins[v4])??!1,d4=d02>maxDistance||isForbidden?Number.POSITIVE_INFINITY:d02;(d4<bestDist[v4]||d4===bestDist[v4]&&pins[u5].pinId<pins[parent[v4]]?.pinId)&&(bestDist[v4]=d4,parent[v4]=u5)}}return edges}var getPinDirection2=(pin,chip)=>{let{x:x4,y:y4}=pin,{center:center2,width,height}=chip,yPlusEdge=center2.y+height/2,yMinusEdge=center2.y-height/2,xPlusEdge=center2.x+width/2,xMinusEdge=center2.x-width/2,yPlusDistance=yPlusEdge-y4,yMinusDistance=y4-yMinusEdge,xPlusDistance=xPlusEdge-x4,xMinusDistance=x4-xMinusEdge,minDistance=Math.min(yPlusDistance,yMinusDistance,xPlusDistance,xMinusDistance);return minDistance===yPlusDistance?"y+":minDistance===yMinusDistance?"y-":minDistance===xPlusDistance?"x+":"x-"},getRestrictedCenterLines=params=>{let{pins,inputProblem,pinIdMap,chipMap}=params,findAllDirectlyConnectedPins=startPinId=>{let visited=new Set,queue=[startPinId];visited.add(startPinId);let directConns=inputProblem.directConnections||[];for(;queue.length;){let cur=queue.shift();for(let dc3 of directConns)if(dc3.pinIds.includes(cur))for(let p4 of dc3.pinIds)visited.has(p4)||(visited.add(p4),queue.push(p4))}return visited},p02=pins[0].pinId,p12=pins[1].pinId,relatedPinIds=new Set([...findAllDirectlyConnectedPins(p02),...findAllDirectlyConnectedPins(p12)]),restrictedCenterLines=new Map,chipFacingMap=new Map,chipsOfFacingPins=new Set(pins.map(p4=>p4.chipId));for(let pinId of relatedPinIds){let pin=pinIdMap.get(pinId);if(!pin)continue;let chip=chipMap[pin.chipId];if(!chip)continue;let facing=pin._facingDirection??getPinDirection2(pin,chip),entry=chipFacingMap.get(chip.chipId);if(!entry){entry={center:chip.center};let counts={xPos:0,xNeg:0,yPos:0,yNeg:0};for(let cp2 of chip.pins){let cpFacing=cp2._facingDirection??getPinDirection2(cp2,chip);cpFacing==="x+"&&counts.xPos++,cpFacing==="x-"&&counts.xNeg++,cpFacing==="y+"&&counts.yPos++,cpFacing==="y-"&&counts.yNeg++}entry.counts=counts,chipFacingMap.set(chip.chipId,entry)}facing==="x+"&&(entry.hasXPos=!0),facing==="x-"&&(entry.hasXNeg=!0),facing==="y+"&&(entry.hasYPos=!0),facing==="y-"&&(entry.hasYNeg=!0)}for(let[chipId,faces]of chipFacingMap){let axes=new Set,rcl={axes},counts=faces.counts;!(counts&&(counts.xPos>1||counts.xNeg>1||counts.yPos>1||counts.yNeg>1))&&chipsOfFacingPins.has(chipId)||(faces.hasXPos&&faces.hasXNeg&&(rcl.x=faces.center.x,axes.add("x")),faces.hasYPos&&faces.hasYNeg&&(rcl.y=faces.center.y,axes.add("y"))),axes.size>0&&restrictedCenterLines.set(chipId,rcl)}return restrictedCenterLines},doesPairCrossRestrictedCenterLines=params=>{let{inputProblem,chipMap,pinIdMap,p1:p12,p2:p22}=params,restrictedCenterLines=getRestrictedCenterLines({pins:[p12,p22],inputProblem,pinIdMap,chipMap});if(restrictedCenterLines.size===0)return!1;let EPS92=1e-9,crossesSegment=(a3,b3)=>{for(let[,rcl]of restrictedCenterLines)if(rcl.axes.has("x")&&typeof rcl.x=="number"&&(a3.x-rcl.x)*(b3.x-rcl.x)<-EPS92||rcl.axes.has("y")&&typeof rcl.y=="number"&&(a3.y-rcl.y)*(b3.y-rcl.y)<-EPS92)return!0;return!1};if(Math.abs(p12.x-p22.x)<EPS92||Math.abs(p12.y-p22.y)<EPS92)return crossesSegment({x:p12.x,y:p12.y},{x:p22.x,y:p22.y});let elbowHV={x:p22.x,y:p12.y},elbowVH={x:p12.x,y:p22.y},hvCrosses=crossesSegment({x:p12.x,y:p12.y},elbowHV)||crossesSegment(elbowHV,{x:p22.x,y:p22.y}),vhCrosses=crossesSegment({x:p12.x,y:p12.y},elbowVH)||crossesSegment(elbowVH,{x:p22.x,y:p22.y});return hvCrosses&&vhCrosses},getColorFromString2=(string,alpha=1)=>`hsl(${string.split("").reduce((acc,char)=>acc*31+char.charCodeAt(0),0)%360}, 100%, 50%, ${alpha})`,getSectionNameForPin=(sectionByChipId,sectionByPinId,pin)=>{if(pin.chipId){let chipSection=sectionByChipId.get(pin.chipId);if(chipSection)return chipSection}return sectionByPinId.get(pin.pinId)},arePinsInDifferentSchematicSections=(inputProblem,p12,p22)=>{let sectionByChipId=new Map,sectionByPinId=new Map;for(let chip of inputProblem.chips)if(chip.sectionId){sectionByChipId.set(chip.chipId,chip.sectionId);for(let pin of chip.pins)sectionByPinId.set(pin.pinId,chip.sectionId)}if(sectionByChipId.size===0)return!1;let s12=getSectionNameForPin(sectionByChipId,sectionByPinId,p12),s22=getSectionNameForPin(sectionByChipId,sectionByPinId,p22);return!!s12&&!!s22&&s12!==s22},visualizeInputProblem2=(inputProblem,opts={})=>{let{connectionAlpha=.8,chipAlpha=.8}=opts,graphics={lines:[],points:[],rects:[]},pinIdMap=new Map;for(let chip of inputProblem.chips)for(let pin of chip.pins)pinIdMap.set(pin.pinId,pin);for(let chip of inputProblem.chips){graphics.rects.push({label:chip.chipId,center:chip.center,width:chip.width,height:chip.height,fill:getColorFromString2(chip.chipId,chipAlpha)});for(let pin of chip.pins)graphics.points.push({label:`${pin.pinId}
|
|
649
|
-
${pin._facingDirection??getPinDirection2(pin,chip)}`,x:pin.x,y:pin.y,color:getColorFromString2(pin.pinId,.8)})}for(let directConn of inputProblem.directConnections){let[pinId1,pinId2]=directConn.pinIds,pin1=pinIdMap.get(pinId1),pin2=pinIdMap.get(pinId2);arePinsInDifferentSchematicSections(inputProblem,pin1,pin2)||graphics.lines.push({points:[{x:pin1.x,y:pin1.y},{x:pin2.x,y:pin2.y}],strokeColor:getColorFromString2(directConn.netId??`${pinId1}-${pinId2}`,connectionAlpha)})}for(let netConn of inputProblem.netConnections){let pins=netConn.pinIds.map(pinId=>pinIdMap.get(pinId));for(let i3=0;i3<pins.length-1;i3++)for(let j4=i3+1;j4<pins.length;j4++){let pin1=pins[i3],pin2=pins[j4];arePinsInDifferentSchematicSections(inputProblem,pin1,pin2)||graphics.lines.push({points:[{x:pin1.x,y:pin1.y},{x:pin2.x,y:pin2.y}],strokeColor:getColorFromString2(netConn.netId,connectionAlpha),strokeDash:"4 2"})}}return graphics},MspConnectionPairSolver=class extends BaseSolver5{constructor({inputProblem}){super();__publicField(this,"inputProblem");__publicField(this,"mspConnectionPairs",[]);__publicField(this,"dcConnMap");__publicField(this,"globalConnMap");__publicField(this,"queuedDcNetIds");__publicField(this,"chipMap");__publicField(this,"maxMspPairDistance");__publicField(this,"pinMap");__publicField(this,"userNetIdByPinId");this.inputProblem=inputProblem,this.maxMspPairDistance=inputProblem.maxMspPairDistance??1;let{directConnMap,netConnMap}=getConnectivityMapsFromInputProblem(inputProblem);this.dcConnMap=directConnMap,this.globalConnMap=netConnMap,this.pinMap={};for(let chip of inputProblem.chips)for(let pin of chip.pins)this.pinMap[pin.pinId]={...pin,chipId:chip.chipId};this.chipMap={};for(let chip of inputProblem.chips)this.chipMap[chip.chipId]=chip;this.userNetIdByPinId={};for(let dc3 of inputProblem.directConnections)if(dc3.netId){let[a3,b3]=dc3.pinIds;this.userNetIdByPinId[a3]=dc3.netId,this.userNetIdByPinId[b3]=dc3.netId}for(let nc3 of inputProblem.netConnections)for(let pid of nc3.pinIds)this.userNetIdByPinId[pid]=nc3.netId;this.queuedDcNetIds=Object.keys(netConnMap.netMap)}getConstructorParams(){return{inputProblem:this.inputProblem}}_step(){if(this.queuedDcNetIds.length===0){this.solved=!0;return}let dcNetId=this.queuedDcNetIds.shift(),directlyConnectedPins=this.globalConnMap.getIdsConnectedToNet(dcNetId).filter(id2=>!!this.pinMap[id2]);if(directlyConnectedPins.length<=1)return;if(directlyConnectedPins.length===2){let[pin1,pin2]=directlyConnectedPins,p12=this.pinMap[pin1],p22=this.pinMap[pin2];if(Math.abs(p12.x-p22.x)+Math.abs(p12.y-p22.y)>this.maxMspPairDistance||arePinsInDifferentSchematicSections(this.inputProblem,p12,p22))return;let pinIdMap2=new Map(Object.entries(this.pinMap));if(doesPairCrossRestrictedCenterLines({inputProblem:this.inputProblem,chipMap:this.chipMap,pinIdMap:pinIdMap2,p1:p12,p2:p22}))return;let globalConnNetId=this.globalConnMap.getNetConnectedToId(pin1),userNetId=this.userNetIdByPinId[pin1]??this.userNetIdByPinId[pin2];this.mspConnectionPairs.push({mspPairId:`${pin1}-${pin2}`,dcConnNetId:dcNetId,globalConnNetId,userNetId,pins:[p12,p22]});return}let pinIdMap=new Map(Object.entries(this.pinMap)),msp=getOrthogonalMinimumSpanningTree(directlyConnectedPins.map(p4=>this.pinMap[p4]).filter(Boolean),{maxDistance:this.maxMspPairDistance,forbidEdge:(a3,b3)=>arePinsInDifferentSchematicSections(this.inputProblem,a3,b3)||doesPairCrossRestrictedCenterLines({inputProblem:this.inputProblem,chipMap:this.chipMap,pinIdMap,p1:a3,p2:b3})});for(let[pin1,pin2]of msp){let p1Obj=this.pinMap[pin1],p2Obj=this.pinMap[pin2];if(arePinsInDifferentSchematicSections(this.inputProblem,p1Obj,p2Obj)||doesPairCrossRestrictedCenterLines({inputProblem:this.inputProblem,chipMap:this.chipMap,pinIdMap,p1:p1Obj,p2:p2Obj}))continue;let globalConnNetId=this.globalConnMap.getNetConnectedToId(pin1),userNetId=this.userNetIdByPinId[pin1]??this.userNetIdByPinId[pin2];this.mspConnectionPairs.push({mspPairId:`${pin1}-${pin2}`,dcConnNetId:dcNetId,globalConnNetId,userNetId,pins:[p1Obj,p2Obj]})}}visualize(){let graphics=visualizeInputProblem2(this.inputProblem,{chipAlpha:.1,connectionAlpha:.1});for(let pair of this.mspConnectionPairs)graphics.lines.push({points:[{x:pair.pins[0].x,y:pair.pins[0].y},{x:pair.pins[1].x,y:pair.pins[1].y}],strokeColor:getColorFromString2(pair.mspPairId,.75)});return graphics}};function getInputChipBounds(chip){let halfWidth=chip.width/2,halfHeight=chip.height/2;return{minX:chip.center.x-halfWidth,maxX:chip.center.x+halfWidth,minY:chip.center.y-halfHeight,maxY:chip.center.y+halfHeight}}var chipToRect=chip=>{let b3=getInputChipBounds(chip);return{chipId:chip.chipId,...b3}},getObstacleRects=problem=>problem.chips.map(chipToRect),EPS2=1e-9,isVertical=(a3,b3,eps=EPS2)=>Math.abs(a3.x-b3.x)<eps,isHorizontal=(a3,b3,eps=EPS2)=>Math.abs(a3.y-b3.y)<eps,segmentIntersectsRect=(a3,b3,r5,eps=EPS2)=>{let vert=isVertical(a3,b3,eps),horz=isHorizontal(a3,b3,eps);if(!vert&&!horz)return!1;if(vert){let x4=a3.x;if(x4<r5.minX-eps||x4>r5.maxX+eps)return!1;let segMinY=Math.min(a3.y,b3.y),segMaxY=Math.max(a3.y,b3.y);return Math.min(segMaxY,r5.maxY)-Math.max(segMinY,r5.minY)>eps}else{let y4=a3.y;if(y4<r5.minY-eps||y4>r5.maxY+eps)return!1;let segMinX=Math.min(a3.x,b3.x),segMaxX=Math.max(a3.x,b3.x);return Math.min(segMaxX,r5.maxX)-Math.max(segMinX,r5.minX)>eps}},findFirstCollision=(pts,rects,opts={})=>{for(let i3=0;i3<pts.length-1;i3++){let a3=pts[i3],b3=pts[i3+1],excluded=opts.excludeRectIdsForSegment?.(i3)??new Set;for(let r5 of rects)if(!excluded.has(r5.chipId)&&segmentIntersectsRect(a3,b3,r5))return{segIndex:i3,rect:r5}}return null},isPathCollidingWithObstacles=(path,obstacles)=>{for(let i3=0;i3<path.length-1;i3++)for(let obstacle of obstacles)if(segmentIntersectsRect(path[i3],path[i3+1],obstacle))return!0;return!1},EPS22=1e-9,aabbFromPoints=(a3,b3)=>({minX:Math.min(a3.x,b3.x),maxX:Math.max(a3.x,b3.x),minY:Math.min(a3.y,b3.y),maxY:Math.max(a3.y,b3.y)}),midBetweenPointAndRect=(axis,p4,r5,eps=EPS22)=>axis==="x"?p4.x<r5.minX-eps?[(p4.x+r5.minX)/2]:p4.x>r5.maxX+eps?[(p4.x+r5.maxX)/2]:[r5.minX-.2,r5.maxX+.2]:p4.y<r5.minY-eps?[(p4.y+r5.minY)/2]:p4.y>r5.maxY+eps?[(p4.y+r5.maxY)/2]:[r5.minY-.2,r5.maxY+.2],candidateMidsFromSet=(axis,colliding,rectsById,collisionRectIds,aabb,eps=EPS22)=>{let setRects=[...collisionRectIds].map(id2=>rectsById.get(id2)).filter(r5=>!!r5);if(axis==="x"){let leftBoundaries=[aabb.minX,...setRects.map(r5=>r5.maxX)].filter(v4=>v4<colliding.minX-eps),rightBoundaries=[aabb.maxX,...setRects.map(r5=>r5.minX)].filter(v4=>v4>colliding.maxX+eps),leftNeighbor=leftBoundaries.length>0?Math.max(...leftBoundaries):void 0,rightNeighbor=rightBoundaries.length>0?Math.min(...rightBoundaries):void 0,out=[];return leftNeighbor!==void 0&&out.push((leftNeighbor+colliding.minX)/2),rightNeighbor!==void 0&&out.push((colliding.maxX+rightNeighbor)/2),out}else{let bottomBoundaries=[aabb.minY,...setRects.map(r5=>r5.maxY)].filter(v4=>v4<colliding.minY-eps),topBoundaries=[aabb.maxY,...setRects.map(r5=>r5.minY)].filter(v4=>v4>colliding.maxY+eps),bottomNeighbor=bottomBoundaries.length>0?Math.max(...bottomBoundaries):void 0,topNeighbor=topBoundaries.length>0?Math.min(...topBoundaries):void 0,out=[];return bottomNeighbor!==void 0&&out.push((bottomNeighbor+colliding.minY)/2),topNeighbor!==void 0&&out.push((colliding.maxY+topNeighbor)/2),out}},EPS3=1e-9,shiftSegmentOrth=(pts,segIndex,axis,newCoord,eps=EPS3)=>{if(segIndex<0||segIndex>=pts.length-1)return null;let a3=pts[segIndex],b3=pts[segIndex+1],vert=isVertical(a3,b3,eps),horz=isHorizontal(a3,b3,eps);if(!vert&&!horz||vert&&axis!=="x"||horz&&axis!=="y")return null;let out=pts.map(p4=>({...p4}));if(axis==="x"){if(Math.abs(a3.x-newCoord)<eps&&Math.abs(b3.x-newCoord)<eps)return null;out[segIndex]={...out[segIndex],x:newCoord},out[segIndex+1]={...out[segIndex+1],x:newCoord}}else{if(Math.abs(a3.y-newCoord)<eps&&Math.abs(b3.y-newCoord)<eps)return null;out[segIndex]={...out[segIndex],y:newCoord},out[segIndex+1]={...out[segIndex+1],y:newCoord}}if(segIndex-1>=0){let p4=out[segIndex-1],q4=out[segIndex];if(Math.abs(p4.x-q4.x)+Math.abs(p4.y-q4.y)<eps)return null}if(segIndex+2<=out.length-1){let p4=out[segIndex+1],q4=out[segIndex+2];if(Math.abs(p4.x-q4.x)+Math.abs(p4.y-q4.y)<eps)return null}for(let i3=0;i3<out.length-1;i3++){let u5=out[i3],v4=out[i3+1];if(!isHorizontal(u5,v4,eps)&&!isVertical(u5,v4,eps))return null}return out},pathKey=(pts,decimals=6)=>pts.map(p4=>`${p4.x.toFixed(decimals)},${p4.y.toFixed(decimals)}`).join("|"),SchematicTraceSingleLineSolver2=class extends BaseSolver5{constructor(params){super();__publicField(this,"pins");__publicField(this,"inputProblem");__publicField(this,"chipMap");__publicField(this,"obstacles");__publicField(this,"rectById");__publicField(this,"aabb");__publicField(this,"baseElbow");__publicField(this,"solvedTracePath",null);__publicField(this,"queue",[]);__publicField(this,"visited",new Set);this.pins=params.pins,this.inputProblem=params.inputProblem,this.chipMap=params.chipMap;for(let pin of this.pins)if(!pin._facingDirection){let chip=this.chipMap[pin.chipId];pin._facingDirection=getPinDirection2(pin,chip)}this.obstacles=getObstacleRects(this.inputProblem),this.rectById=new Map(this.obstacles.map(r5=>[r5.chipId,r5]));let[pin1,pin2]=this.pins;this.baseElbow=calculateElbow({x:pin1.x,y:pin1.y,facingDirection:pin1._facingDirection},{x:pin2.x,y:pin2.y,facingDirection:pin2._facingDirection},{overshoot:.2}),this.aabb=aabbFromPoints({x:pin1.x,y:pin1.y},{x:pin2.x,y:pin2.y}),this.queue.push({path:this.baseElbow,collisionChipIds:new Set}),this.visited.add(pathKey(this.baseElbow))}getConstructorParams(){return{chipMap:this.chipMap,pins:this.pins,inputProblem:this.inputProblem}}axisOfSegment(a3,b3){return isVertical(a3,b3)?"x":isHorizontal(a3,b3)?"y":null}pathLength(pts){let sum=0;for(let i3=0;i3<pts.length-1;i3++)sum+=Math.abs(pts[i3+1].x-pts[i3].x)+Math.abs(pts[i3+1].y-pts[i3].y);return sum}_step(){if(this.solvedTracePath){this.solved=!0;return}let state2=this.queue.shift();if(!state2){this.failed=!0,this.error="No collision-free path found";return}let{path,collisionChipIds}=state2,[PA2,PB]=this.pins,collision=findFirstCollision(path,this.obstacles);if(!collision){let first=path[0],last=path[path.length-1],EPS92=1e-9,samePoint=(p4,q4)=>Math.abs(p4.x-q4.x)<EPS92&&Math.abs(p4.y-q4.y)<EPS92;samePoint(first,{x:PA2.x,y:PA2.y})&&samePoint(last,{x:PB.x,y:PB.y})&&(this.solvedTracePath=path,this.solved=!0);return}let{segIndex,rect}=collision,isFirstSegment=segIndex===0,isLastSegment=segIndex===path.length-2;if(isFirstSegment){if(path.length<3)return;segIndex=1}else if(isLastSegment){if(path.length<3)return;segIndex=path.length-3}let a3=path[segIndex],b3=path[segIndex+1],axis=this.axisOfSegment(a3,b3);if(!axis)return;let candidates=[];if(collisionChipIds.size===0){let m12=midBetweenPointAndRect(axis,{x:PA2.x,y:PA2.y},rect),m22=midBetweenPointAndRect(axis,{x:PB.x,y:PB.y},rect),allCandidates=[...m12,...m22],uniqueCandidates=[...new Set(allCandidates)];candidates.push(...uniqueCandidates)}else{let mids=candidateMidsFromSet(axis,rect,this.rectById,collisionChipIds,this.aabb);candidates.push(...mids)}let newStates=[];for(let coord of candidates){let newPath=shiftSegmentOrth(path,segIndex,axis,coord);if(!newPath)continue;let key=pathKey(newPath);if(this.visited.has(key))continue;this.visited.add(key);let nextSet=new Set(collisionChipIds);nextSet.add(rect.chipId);let len=this.pathLength(newPath);newStates.push({path:newPath,collisionRectIds:nextSet,len})}newStates.sort((a22,b22)=>a22.len-b22.len);for(let st3 of newStates)this.queue.push({path:st3.path,collisionChipIds:st3.collisionRectIds})}visualize(){let g6=visualizeInputProblem2(this.inputProblem,{chipAlpha:.1,connectionAlpha:.1});g6.lines.push({points:this.baseElbow,strokeColor:"red",strokeDash:"4 4"});let[pin1,pin2]=this.pins;g6.lines.push({points:[{x:pin1.x,y:pin1.y},{x:pin2.x,y:pin2.y}],strokeColor:"blue",strokeDash:"5 5"});for(let{path,collisionChipIds:collisionRectIds}of this.queue)g6.lines.push({points:path,strokeColor:"teal",strokeDash:"2 2"});return this.solvedTracePath?g6.lines.push({points:this.solvedTracePath,strokeColor:"green"}):this.queue.length>0&&g6.lines.push({points:this.queue[0].path,strokeColor:"orange"}),g6}},SchematicTraceLinesSolver=class extends BaseSolver5{constructor(params){super();__publicField(this,"inputProblem");__publicField(this,"mspConnectionPairs");__publicField(this,"dcConnMap");__publicField(this,"globalConnMap");__publicField(this,"queuedConnectionPairs");__publicField(this,"chipMap");__publicField(this,"currentConnectionPair",null);__publicField(this,"solvedTracePaths",[]);__publicField(this,"failedConnectionPairs",[]);this.inputProblem=params.inputProblem,this.mspConnectionPairs=params.mspConnectionPairs,this.dcConnMap=params.dcConnMap,this.globalConnMap=params.globalConnMap,this.chipMap=params.chipMap,this.queuedConnectionPairs=[...this.mspConnectionPairs]}getConstructorParams(){return{inputProblem:this.inputProblem,chipMap:this.chipMap,mspConnectionPairs:this.mspConnectionPairs,dcConnMap:this.dcConnMap,globalConnMap:this.globalConnMap}}_step(){if(this.activeSubSolver?.solved&&(this.solvedTracePaths.push({...this.currentConnectionPair,tracePath:this.activeSubSolver.solvedTracePath,mspConnectionPairIds:[this.currentConnectionPair.mspPairId],pinIds:[this.currentConnectionPair.pins[0].pinId,this.currentConnectionPair.pins[1].pinId]}),this.activeSubSolver=null,this.currentConnectionPair=null),this.activeSubSolver?.failed&&(this.currentConnectionPair&&this.failedConnectionPairs.push({...this.currentConnectionPair,error:this.activeSubSolver.error||void 0}),this.activeSubSolver=null,this.currentConnectionPair=null),this.activeSubSolver){this.activeSubSolver.step();return}let connectionPair=this.queuedConnectionPairs.shift();if(!connectionPair){this.solved=!0;return}this.currentConnectionPair=connectionPair;let{pins}=connectionPair;this.activeSubSolver=new SchematicTraceSingleLineSolver2({inputProblem:this.inputProblem,pins,chipMap:this.chipMap})}visualize(){if(this.activeSubSolver)return this.activeSubSolver.visualize();let graphics=visualizeInputProblem2(this.inputProblem,{chipAlpha:.1,connectionAlpha:.1});for(let{mspPairId,tracePath}of this.solvedTracePaths)graphics.lines.push({points:tracePath,strokeColor:"green"});for(let pair of this.failedConnectionPairs)graphics.lines.push({points:[{x:pair.pins[0].x,y:pair.pins[0].y},{x:pair.pins[1].x,y:pair.pins[1].y}],strokeColor:"red",strokeDash:"4 2"});return graphics}},applyJogToTerminalSegment=({pts,segmentIndex:si3,offset,JOG_SIZE,EPS:EPS92=1e-6})=>{if(si3!==0&&si3!==pts.length-2)return;let start=pts[si3],end=pts[si3+1],isVertical4=Math.abs(start.x-end.x)<EPS92,isHorizontal3=Math.abs(start.y-end.y)<EPS92;if(!isVertical4&&!isHorizontal3)return;let segDir=isVertical4?end.y>start.y?1:-1:end.x>start.x?1:-1;if(si3===0)if(isVertical4){let jogY=start.y+segDir*JOG_SIZE;pts.splice(1,1,{x:start.x,y:jogY},{x:start.x+offset,y:jogY},{x:end.x+offset,y:end.y})}else{let jogX=start.x+segDir*JOG_SIZE;pts.splice(1,1,{x:jogX,y:start.y},{x:jogX,y:start.y+offset},{x:end.x,y:end.y+offset})}else if(isVertical4){let jogY=end.y-segDir*JOG_SIZE;pts.splice(si3,1,{x:start.x+offset,y:start.y},{x:end.x+offset,y:jogY},{x:end.x,y:jogY})}else{let jogX=end.x-segDir*JOG_SIZE;pts.splice(si3,1,{x:start.x,y:start.y+offset},{x:jogX,y:end.y+offset},{x:jogX,y:end.y})}},TraceOverlapIssueSolver=class extends BaseSolver5{constructor(params){super();__publicField(this,"overlappingTraceSegments");__publicField(this,"traceNetIslands");__publicField(this,"SHIFT_DISTANCE",.1);__publicField(this,"correctedTraceMap",{});this.overlappingTraceSegments=params.overlappingTraceSegments,this.traceNetIslands=params.traceNetIslands;for(let{connNetId,pathsWithOverlap}of this.overlappingTraceSegments)for(let{solvedTracePathIndex,traceSegmentIndex}of pathsWithOverlap){let mspPairId=this.traceNetIslands[connNetId][solvedTracePathIndex].mspPairId;this.correctedTraceMap[mspPairId]=this.traceNetIslands[connNetId][solvedTracePathIndex]}}_step(){let offsets=this.overlappingTraceSegments.map((_4,idx)=>{let n4=Math.floor(idx/2)+1;return(idx%2===0?-n4:n4)*this.SHIFT_DISTANCE}),eq=(a3,b3)=>Math.abs(a3-b3)<1e-6,samePoint=(p4,q4)=>!!p4&&!!q4&&eq(p4.x,q4.x)&&eq(p4.y,q4.y);this.overlappingTraceSegments.forEach((group,gidx)=>{let offset=offsets[gidx],byPath=new Map;for(let loc of group.pathsWithOverlap)byPath.has(loc.solvedTracePathIndex)||byPath.set(loc.solvedTracePathIndex,new Set),byPath.get(loc.solvedTracePathIndex).add(loc.traceSegmentIndex);for(let[pathIdx,segIdxSet]of byPath){let original=this.traceNetIslands[group.connNetId][pathIdx],current3=this.correctedTraceMap[original.mspPairId]??original,pts=current3.tracePath.map(p4=>({...p4})),segIdxs=Array.from(segIdxSet).sort((a3,b3)=>a3-b3),segIdxsRev=Array.from(segIdxSet).sort((a3,b3)=>a3-b3).reverse(),JOG_SIZE=this.SHIFT_DISTANCE;for(let si3 of segIdxsRev)if(!(si3<0||si3>=pts.length-1))if(si3===0||si3===pts.length-2)applyJogToTerminalSegment({pts,segmentIndex:si3,offset,JOG_SIZE,EPS:1e-6});else{let start=pts[si3],end=pts[si3+1],isVertical4=Math.abs(start.x-end.x)<1e-6,isHorizontal3=Math.abs(start.y-end.y)<1e-6;if(!isVertical4&&!isHorizontal3)continue;isVertical4?(start.x+=offset,end.x+=offset):(start.y+=offset,end.y+=offset)}let cleaned=[];for(let p4 of pts)(cleaned.length===0||!samePoint(cleaned[cleaned.length-1],p4))&&cleaned.push(p4);this.correctedTraceMap[original.mspPairId]={...current3,tracePath:cleaned}}}),this.solved=!0}visualize(){let graphics={lines:[],points:[],rects:[],circles:[]};for(let group of this.overlappingTraceSegments)for(let{solvedTracePathIndex,traceSegmentIndex}of group.pathsWithOverlap){let path=this.traceNetIslands[group.connNetId][solvedTracePathIndex],segStart=path.tracePath[traceSegmentIndex],segEnd=path.tracePath[traceSegmentIndex+1];graphics.lines.push({points:[segStart,segEnd],strokeColor:"red"})}for(let trace of Object.values(this.correctedTraceMap))graphics.lines.push({points:trace.tracePath,strokeColor:"blue",strokeDash:"4 2"});return graphics}},TraceOverlapShiftSolver=class extends BaseSolver5{constructor(params){super();__publicField(this,"inputProblem");__publicField(this,"inputTracePaths");__publicField(this,"globalConnMap");__publicField(this,"traceNetIslands",{});__publicField(this,"correctedTraceMap",{});__publicField(this,"cleanupPhase",null);this.inputProblem=params.inputProblem,this.inputTracePaths=params.inputTracePaths,this.globalConnMap=params.globalConnMap;for(let tracePath of this.inputTracePaths){let{mspPairId}=tracePath;this.correctedTraceMap[mspPairId]=tracePath}this.traceNetIslands=this.computeTraceNetIslands()}getConstructorParams(){return{inputProblem:this.inputProblem,inputTracePaths:this.inputTracePaths,globalConnMap:this.globalConnMap}}computeTraceNetIslands(){let islands={};for(let original of this.inputTracePaths){let path=this.correctedTraceMap[original.mspPairId]??original,key=path.globalConnNetId;islands[key]||(islands[key]=[]),islands[key].push(path)}return islands}findNextOverlapIssue(){let netIds=Object.keys(this.traceNetIslands);for(let i3=0;i3<netIds.length;i3++)for(let j4=i3+1;j4<netIds.length;j4++){let netA=netIds[i3],netB=netIds[j4],pathsA=this.traceNetIslands[netA]||[],pathsB=this.traceNetIslands[netB]||[],overlapsA=[],overlapsB=[],seenA=new Set,seenB=new Set,overlaps1D=(a12,a22,b12,b22)=>{let minA=Math.min(a12,a22),maxA=Math.max(a12,a22),minB=Math.min(b12,b22),maxB=Math.max(b12,b22);return Math.min(maxA,maxB)-Math.max(minA,minB)>.002};for(let pa3=0;pa3<pathsA.length;pa3++){let ptsA=pathsA[pa3].tracePath;for(let sa3=0;sa3<ptsA.length-1;sa3++){let a12=ptsA[sa3],a22=ptsA[sa3+1],aVert=Math.abs(a12.x-a22.x)<.002,aHorz=Math.abs(a12.y-a22.y)<.002;if(!(!aVert&&!aHorz))for(let pb2=0;pb2<pathsB.length;pb2++){let ptsB=pathsB[pb2].tracePath;for(let sb3=0;sb3<ptsB.length-1;sb3++){let b12=ptsB[sb3],b22=ptsB[sb3+1],bVert=Math.abs(b12.x-b22.x)<.002,bHorz=Math.abs(b12.y-b22.y)<.002;if(!(!bVert&&!bHorz)){if(aVert&&bVert){if(Math.abs(a12.x-b12.x)<.002&&overlaps1D(a12.y,a22.y,b12.y,b22.y)){let keyA=`${pa3}:${sa3}`,keyB=`${pb2}:${sb3}`;seenA.has(keyA)||(overlapsA.push({solvedTracePathIndex:pa3,traceSegmentIndex:sa3}),seenA.add(keyA)),seenB.has(keyB)||(overlapsB.push({solvedTracePathIndex:pb2,traceSegmentIndex:sb3}),seenB.add(keyB))}}else if(aHorz&&bHorz&&Math.abs(a12.y-b12.y)<.002&&overlaps1D(a12.x,a22.x,b12.x,b22.x)){let keyA=`${pa3}:${sa3}`,keyB=`${pb2}:${sb3}`;seenA.has(keyA)||(overlapsA.push({solvedTracePathIndex:pa3,traceSegmentIndex:sa3}),seenA.add(keyA)),seenB.has(keyB)||(overlapsB.push({solvedTracePathIndex:pb2,traceSegmentIndex:sb3}),seenB.add(keyB))}}}}}}if(overlapsA.length>0&&overlapsB.length>0)return{overlappingTraceSegments:[{connNetId:netA,pathsWithOverlap:overlapsA},{connNetId:netB,pathsWithOverlap:overlapsB}]}}return null}findNextDiagonalSegment(){for(let mspPairId in this.correctedTraceMap){let tracePath=this.correctedTraceMap[mspPairId].tracePath;for(let i3=0;i3<tracePath.length-1;i3++){let p12=tracePath[i3],p22=tracePath[i3+1],isHorizontal3=Math.abs(p12.y-p22.y)<.002,isVertical4=Math.abs(p12.x-p22.x)<.002;if(!isHorizontal3&&!isVertical4)return{mspPairId,tracePath,i:i3,p1:p12,p2:p22}}}return null}findAndFixNextDiagonalSegment(){let diagonalInfo=this.findNextDiagonalSegment();if(!diagonalInfo)return!1;let{mspPairId,tracePath,i:i3,p1:p12,p2:p22}=diagonalInfo,EPS92=.002,p02=i3>0?tracePath[i3-1]:null,p32=i3+2<tracePath.length?tracePath[i3+2]:null,prevIsVertical=p02?Math.abs(p02.x-p12.x)<EPS92:!1,prevIsHorizontal=p02?Math.abs(p02.y-p12.y)<EPS92:!1,nextIsVertical=p32?Math.abs(p22.x-p32.x)<EPS92:!1,nextIsHorizontal=p32?Math.abs(p22.y-p32.y)<EPS92:!1,elbow1={x:p12.x,y:p22.y},elbow2={x:p22.x,y:p12.y},score1=0;prevIsVertical&&score1++,nextIsHorizontal&&score1++;let score2=0;prevIsHorizontal&&score2++,nextIsVertical&&score2++;let elbowPoint=score1<score2?elbow1:elbow2;return tracePath.splice(i3+1,0,elbowPoint),!0}_step(){if(this.activeSubSolver?.solved){for(let[mspPairId,newTrace]of Object.entries(this.activeSubSolver.correctedTraceMap))this.correctedTraceMap[mspPairId]=newTrace;this.activeSubSolver=null,this.traceNetIslands=this.computeTraceNetIslands()}if(this.activeSubSolver){this.activeSubSolver.step();return}let overlapIssue=this.findNextOverlapIssue();if(overlapIssue===null){if(this.cleanupPhase===null&&(this.cleanupPhase="diagonals"),this.cleanupPhase==="diagonals"){this.findAndFixNextDiagonalSegment()||(this.cleanupPhase="done",this.solved=!0);return}this.solved=!0;return}let{overlappingTraceSegments}=overlapIssue;this.activeSubSolver=new TraceOverlapIssueSolver({overlappingTraceSegments,traceNetIslands:this.traceNetIslands})}visualize(){if(this.activeSubSolver)return this.activeSubSolver.visualize();let graphics=visualizeInputProblem2(this.inputProblem);graphics.circles=graphics.circles||[];for(let trace of Object.values(this.correctedTraceMap))graphics.lines.push({points:trace.tracePath,strokeColor:"purple"});if(this.cleanupPhase==="diagonals"){let diagonalInfo=this.findNextDiagonalSegment();diagonalInfo&&graphics.lines.push({points:[diagonalInfo.p1,diagonalInfo.p2],strokeColor:"red",strokeWidth:.05})}return graphics}},ChipObstacleSpatialIndex=class{constructor(chips){__publicField(this,"chips");__publicField(this,"spatialIndex");__publicField(this,"spatialIndexIdToChip");this.chips=chips.map(chip=>({...chip,bounds:getInputChipBounds(chip),spatialIndexId:null})),this.spatialIndexIdToChip=new Map,this.spatialIndex=new Flatbush(chips.length);for(let chip of this.chips)chip.spatialIndexId=this.spatialIndex.add(chip.bounds.minX,chip.bounds.minY,chip.bounds.maxX,chip.bounds.maxY),this.spatialIndexIdToChip.set(chip.spatialIndexId,chip);this.spatialIndex.finish()}getChipsInBounds(bounds){return this.spatialIndex.search(bounds.minX,bounds.minY,bounds.maxX,bounds.maxY).map(id2=>this.spatialIndexIdToChip.get(id2))}doesOrthogonalLineIntersectChip(line2,opts={}){let excludeChipIds=opts.excludeChipIds??[],[p12,p22]=line2,{x:x12,y:y12}=p12,{x:x22,y:y22}=p22;return this.getChipsInBounds({minX:Math.min(x12,x22),minY:Math.min(y12,y22),maxX:Math.max(x12,x22),maxY:Math.max(y12,y22)}).filter(chip=>!excludeChipIds.includes(chip.chipId)).length>0}},NET_LABEL_HORIZONTAL_WIDTH=.45,NET_LABEL_HORIZONTAL_HEIGHT=.2;function getDimsForOrientation(params){let{orientation:orientation4,netLabelWidth}=params,horizWidth=typeof netLabelWidth=="number"?netLabelWidth:NET_LABEL_HORIZONTAL_WIDTH;return orientation4==="y+"||orientation4==="y-"?{width:NET_LABEL_HORIZONTAL_HEIGHT,height:horizWidth}:{width:horizWidth,height:NET_LABEL_HORIZONTAL_HEIGHT}}function getCenterFromAnchor(anchor,orientation4,width,height){switch(orientation4){case"x+":return{x:anchor.x+width/2,y:anchor.y};case"x-":return{x:anchor.x-width/2,y:anchor.y};case"y+":return{x:anchor.x,y:anchor.y+height/2};case"y-":return{x:anchor.x,y:anchor.y-height/2}}}function getRectBounds(center2,w4,h6){return{minX:center2.x-w4/2,minY:center2.y-h6/2,maxX:center2.x+w4/2,maxY:center2.y+h6/2}}function segmentIntersectsRect2(p12,p22,rect,EPS92=1e-9){let isVert=Math.abs(p12.x-p22.x)<EPS92,isHorz=Math.abs(p12.y-p22.y)<EPS92;if(!isVert&&!isHorz)return!1;if(isVert){let x4=p12.x;if(x4<rect.minX-EPS92||x4>rect.maxX+EPS92)return!1;let segMinY=Math.min(p12.y,p22.y),segMaxY=Math.max(p12.y,p22.y);return Math.min(segMaxY,rect.maxY)-Math.max(segMinY,rect.minY)>EPS92}else{let y4=p12.y;if(y4<rect.minY-EPS92||y4>rect.maxY+EPS92)return!1;let segMinX=Math.min(p12.x,p22.x),segMaxX=Math.max(p12.x,p22.x);return Math.min(segMaxX,rect.maxX)-Math.max(segMinX,rect.minX)>EPS92}}function rectIntersectsAnyTrace(bounds,inputTraceMap,hostPathId,hostSegIndex){for(let[pairId,solved]of Object.entries(inputTraceMap)){let pts=solved.tracePath;for(let i3=0;i3<pts.length-1;i3++)if(!(pairId===hostPathId&&i3===hostSegIndex)&&segmentIntersectsRect2(pts[i3],pts[i3+1],bounds))return{hasIntersection:!0,mspPairId:pairId,segIndex:i3}}return{hasIntersection:!1}}function lengthOfTrace(path){let sum=0,pts=path.tracePath;for(let i3=0;i3<pts.length-1;i3++)sum+=Math.abs(pts[i3+1].x-pts[i3].x)+Math.abs(pts[i3+1].y-pts[i3].y);return sum}function chooseHostTraceForGroup(params){let{inputProblem,inputTraceMap,globalConnNetId,fallbackTrace,mspConnectionPairIds}=params,chipsById=Object.fromEntries(inputProblem.chips.map(c4=>[c4.chipId,c4])),groupTraces=Object.values(inputTraceMap).filter(t52=>t52.globalConnNetId===globalConnNetId);if(mspConnectionPairIds&&mspConnectionPairIds.length>0){let idSet=new Set(mspConnectionPairIds);groupTraces=groupTraces.filter(t52=>t52.mspConnectionPairIds.some(id2=>idSet.has(id2)))}let chipIdsInGroup=new Set;for(let t52 of groupTraces)chipIdsInGroup.add(t52.pins[0].chipId),chipIdsInGroup.add(t52.pins[1].chipId);let largestChipId=null,largestPinCount=-1;for(let id2 of chipIdsInGroup){let count=chipsById[id2]?.pins?.length??0;count>largestPinCount&&(largestPinCount=count,largestChipId=id2)}let hostCandidates=largestChipId==null?[]:groupTraces.filter(t52=>t52.pins[0].chipId===largestChipId||t52.pins[1].chipId===largestChipId);return hostCandidates.length>0?hostCandidates.reduce((a3,b3)=>lengthOfTrace(a3)>=lengthOfTrace(b3)?a3:b3):fallbackTrace}function anchorsForSegment(a3,b3){return[{x:a3.x,y:a3.y},{x:(a3.x+b3.x)/2,y:(a3.y+b3.y)/2},{x:b3.x,y:b3.y}]}function solveNetLabelPlacementForPortOnlyPin(params){let{inputProblem,inputTraceMap,chipObstacleSpatialIndex,overlappingSameNetTraceGroup,availableOrientations,netLabelWidth}=params,pinId=overlappingSameNetTraceGroup.portOnlyPinId;if(!pinId)return{placement:null,testedCandidates:[],error:"No portOnlyPinId provided"};let pin=null,pinFacingDirection=null;for(let chip of inputProblem.chips){let p4=chip.pins.find(pp3=>pp3.pinId===pinId);if(p4){pin={x:p4.x,y:p4.y},pinFacingDirection=p4._facingDirection||getPinDirection2(p4,chip);break}}if(!pin||!pinFacingDirection)return{placement:null,testedCandidates:[],error:`Port-only pin not found: ${pinId}`};let orientations=availableOrientations.length>0?availableOrientations:["x+","x-","y+","y-"],anchor={x:pin.x,y:pin.y},outwardOf=o4=>o4==="x+"?{x:1,y:0}:o4==="x-"?{x:-1,y:0}:o4==="y+"?{x:0,y:1}:{x:0,y:-1},testedCandidates=[];for(let orientation4 of orientations){let{width:width2,height:height2}=getDimsForOrientation({orientation:orientation4,netLabelWidth}),baseCenter2=getCenterFromAnchor(anchor,orientation4,width2,height2),outward2=outwardOf(orientation4),offset2=.001,center2={x:baseCenter2.x+outward2.x*offset2,y:baseCenter2.y+outward2.y*offset2},bounds=getRectBounds(center2,width2,height2);if(chipObstacleSpatialIndex.getChipsInBounds(bounds).length>0){testedCandidates.push({center:center2,width:width2,height:height2,bounds,anchor,orientation:orientation4,status:"chip-collision",hostSegIndex:-1});continue}if(rectIntersectsAnyTrace(bounds,inputTraceMap,"",-1).hasIntersection){testedCandidates.push({center:center2,width:width2,height:height2,bounds,anchor,orientation:orientation4,status:"trace-collision",hostSegIndex:-1});continue}return testedCandidates.push({center:center2,width:width2,height:height2,bounds,anchor,orientation:orientation4,status:"ok",hostSegIndex:-1}),{placement:{globalConnNetId:overlappingSameNetTraceGroup.globalConnNetId,dcConnNetId:void 0,netId:overlappingSameNetTraceGroup.netId,mspConnectionPairIds:[],pinIds:[pinId],orientation:orientation4,anchorPoint:anchor,width:width2,height:height2,center:center2},testedCandidates}}let fallbackOrientation=pinFacingDirection,{width,height}=getDimsForOrientation({orientation:fallbackOrientation,netLabelWidth}),baseCenter=getCenterFromAnchor(anchor,fallbackOrientation,width,height),outward=outwardOf(fallbackOrientation),offset=.001,fallbackCenter={x:baseCenter.x+outward.x*offset,y:baseCenter.y+outward.y*offset};return{placement:{globalConnNetId:overlappingSameNetTraceGroup.globalConnNetId,dcConnNetId:void 0,netId:overlappingSameNetTraceGroup.netId,mspConnectionPairIds:[],pinIds:[pinId],orientation:fallbackOrientation,anchorPoint:anchor,width,height,center:fallbackCenter},testedCandidates}}function visualizeSingleNetLabelPlacementSolver(solver){let graphics=visualizeInputProblem2(solver.inputProblem),groupId=solver.overlappingSameNetTraceGroup.globalConnNetId,host=chooseHostTraceForGroup({inputProblem:solver.inputProblem,inputTraceMap:solver.inputTraceMap,globalConnNetId:groupId,fallbackTrace:solver.overlappingSameNetTraceGroup.overlappingTraces}),groupStroke=getColorFromString2(groupId,.9),groupFill=getColorFromString2(groupId,.5);for(let trace of Object.values(solver.inputTraceMap)){let isHost=host?trace.mspPairId===host.mspPairId:!1;graphics.lines.push({points:trace.tracePath})}for(let c4 of solver.testedCandidates){let fill=c4.status==="ok"?"rgba(0, 180, 0, 0.25)":c4.status==="chip-collision"?"rgba(220, 0, 0, 0.25)":c4.status==="trace-collision"?"rgba(220, 140, 0, 0.25)":"rgba(120, 120, 120, 0.15)",stroke=c4.status==="ok"?"green":c4.status==="chip-collision"?"red":c4.status==="trace-collision"?"orange":"gray",candidateLabel=c4.status==="ok"?"status: ok(valid net label candidate)":c4.status==="chip-collision"?"status: chip-collision":c4.status==="trace-collision"?"status: trace-collision":"status: parallel-to-segment";graphics.rects.push({center:{x:(c4.bounds.minX+c4.bounds.maxX)/2,y:(c4.bounds.minY+c4.bounds.maxY)/2},width:c4.width,height:c4.height,fill,strokeColor:stroke,label:`${candidateLabel}
|
|
650
|
+
${pin._facingDirection??getPinDirection2(pin,chip)}`,x:pin.x,y:pin.y,color:getColorFromString2(pin.pinId,.8)})}for(let directConn of inputProblem.directConnections){let[pinId1,pinId2]=directConn.pinIds,pin1=pinIdMap.get(pinId1),pin2=pinIdMap.get(pinId2);arePinsInDifferentSchematicSections(inputProblem,pin1,pin2)||graphics.lines.push({points:[{x:pin1.x,y:pin1.y},{x:pin2.x,y:pin2.y}],strokeColor:getColorFromString2(directConn.netId??`${pinId1}-${pinId2}`,connectionAlpha)})}for(let netConn of inputProblem.netConnections){let pins=netConn.pinIds.map(pinId=>pinIdMap.get(pinId));for(let i3=0;i3<pins.length-1;i3++)for(let j4=i3+1;j4<pins.length;j4++){let pin1=pins[i3],pin2=pins[j4];arePinsInDifferentSchematicSections(inputProblem,pin1,pin2)||graphics.lines.push({points:[{x:pin1.x,y:pin1.y},{x:pin2.x,y:pin2.y}],strokeColor:getColorFromString2(netConn.netId,connectionAlpha),strokeDash:"4 2"})}}return graphics},MspConnectionPairSolver=class extends BaseSolver5{constructor({inputProblem}){super();__publicField(this,"inputProblem");__publicField(this,"mspConnectionPairs",[]);__publicField(this,"dcConnMap");__publicField(this,"globalConnMap");__publicField(this,"queuedDcNetIds");__publicField(this,"chipMap");__publicField(this,"maxMspPairDistance");__publicField(this,"pinMap");__publicField(this,"userNetIdByPinId");this.inputProblem=inputProblem,this.maxMspPairDistance=inputProblem.maxMspPairDistance??1;let{directConnMap,netConnMap}=getConnectivityMapsFromInputProblem(inputProblem);this.dcConnMap=directConnMap,this.globalConnMap=netConnMap,this.pinMap={};for(let chip of inputProblem.chips)for(let pin of chip.pins)this.pinMap[pin.pinId]={...pin,chipId:chip.chipId};this.chipMap={};for(let chip of inputProblem.chips)this.chipMap[chip.chipId]=chip;this.userNetIdByPinId={};for(let dc3 of inputProblem.directConnections)if(dc3.netId){let[a3,b3]=dc3.pinIds;this.userNetIdByPinId[a3]=dc3.netId,this.userNetIdByPinId[b3]=dc3.netId}for(let nc3 of inputProblem.netConnections)for(let pid of nc3.pinIds)this.userNetIdByPinId[pid]=nc3.netId;this.queuedDcNetIds=Object.keys(netConnMap.netMap)}getConstructorParams(){return{inputProblem:this.inputProblem}}_step(){if(this.queuedDcNetIds.length===0){this.solved=!0;return}let dcNetId=this.queuedDcNetIds.shift(),directlyConnectedPins=this.globalConnMap.getIdsConnectedToNet(dcNetId).filter(id2=>!!this.pinMap[id2]);if(directlyConnectedPins.length<=1)return;if(directlyConnectedPins.length===2){let[pin1,pin2]=directlyConnectedPins,p12=this.pinMap[pin1],p22=this.pinMap[pin2];if(Math.abs(p12.x-p22.x)+Math.abs(p12.y-p22.y)>this.maxMspPairDistance||arePinsInDifferentSchematicSections(this.inputProblem,p12,p22))return;let pinIdMap2=new Map(Object.entries(this.pinMap));if(doesPairCrossRestrictedCenterLines({inputProblem:this.inputProblem,chipMap:this.chipMap,pinIdMap:pinIdMap2,p1:p12,p2:p22}))return;let globalConnNetId=this.globalConnMap.getNetConnectedToId(pin1),userNetId=this.userNetIdByPinId[pin1]??this.userNetIdByPinId[pin2];this.mspConnectionPairs.push({mspPairId:`${pin1}-${pin2}`,dcConnNetId:dcNetId,globalConnNetId,userNetId,pins:[p12,p22]});return}let pinIdMap=new Map(Object.entries(this.pinMap)),msp=getOrthogonalMinimumSpanningTree(directlyConnectedPins.map(p4=>this.pinMap[p4]).filter(Boolean),{maxDistance:this.maxMspPairDistance,forbidEdge:(a3,b3)=>arePinsInDifferentSchematicSections(this.inputProblem,a3,b3)||doesPairCrossRestrictedCenterLines({inputProblem:this.inputProblem,chipMap:this.chipMap,pinIdMap,p1:a3,p2:b3})});for(let[pin1,pin2]of msp){let p1Obj=this.pinMap[pin1],p2Obj=this.pinMap[pin2];if(arePinsInDifferentSchematicSections(this.inputProblem,p1Obj,p2Obj)||doesPairCrossRestrictedCenterLines({inputProblem:this.inputProblem,chipMap:this.chipMap,pinIdMap,p1:p1Obj,p2:p2Obj}))continue;let globalConnNetId=this.globalConnMap.getNetConnectedToId(pin1),userNetId=this.userNetIdByPinId[pin1]??this.userNetIdByPinId[pin2];this.mspConnectionPairs.push({mspPairId:`${pin1}-${pin2}`,dcConnNetId:dcNetId,globalConnNetId,userNetId,pins:[p1Obj,p2Obj]})}}visualize(){let graphics=visualizeInputProblem2(this.inputProblem,{chipAlpha:.1,connectionAlpha:.1});for(let pair of this.mspConnectionPairs)graphics.lines.push({points:[{x:pair.pins[0].x,y:pair.pins[0].y},{x:pair.pins[1].x,y:pair.pins[1].y}],strokeColor:getColorFromString2(pair.mspPairId,.75)});return graphics}};function getInputChipBounds(chip){let halfWidth=chip.width/2,halfHeight=chip.height/2;return{minX:chip.center.x-halfWidth,maxX:chip.center.x+halfWidth,minY:chip.center.y-halfHeight,maxY:chip.center.y+halfHeight}}var chipToRect=chip=>{let b3=getInputChipBounds(chip);return{chipId:chip.chipId,...b3}},getObstacleRects=problem=>problem.chips.map(chipToRect),EPS2=1e-9,isVertical=(a3,b3,eps=EPS2)=>Math.abs(a3.x-b3.x)<eps,isHorizontal=(a3,b3,eps=EPS2)=>Math.abs(a3.y-b3.y)<eps,segmentIntersectsRect=(a3,b3,r5,eps=EPS2)=>{let vert=isVertical(a3,b3,eps),horz=isHorizontal(a3,b3,eps);if(!vert&&!horz)return!1;if(vert){let x4=a3.x;if(x4<r5.minX-eps||x4>r5.maxX+eps)return!1;let segMinY=Math.min(a3.y,b3.y),segMaxY=Math.max(a3.y,b3.y);return Math.min(segMaxY,r5.maxY)-Math.max(segMinY,r5.minY)>eps}else{let y4=a3.y;if(y4<r5.minY-eps||y4>r5.maxY+eps)return!1;let segMinX=Math.min(a3.x,b3.x),segMaxX=Math.max(a3.x,b3.x);return Math.min(segMaxX,r5.maxX)-Math.max(segMinX,r5.minX)>eps}},findFirstCollision=(pts,rects,opts={})=>{for(let i3=0;i3<pts.length-1;i3++){let a3=pts[i3],b3=pts[i3+1],excluded=opts.excludeRectIdsForSegment?.(i3)??new Set;for(let r5 of rects)if(!excluded.has(r5.chipId)&&segmentIntersectsRect(a3,b3,r5))return{segIndex:i3,rect:r5}}return null},isPathCollidingWithObstacles=(path,obstacles)=>{for(let i3=0;i3<path.length-1;i3++)for(let obstacle of obstacles)if(segmentIntersectsRect(path[i3],path[i3+1],obstacle))return!0;return!1},EPS22=1e-9,aabbFromPoints=(a3,b3)=>({minX:Math.min(a3.x,b3.x),maxX:Math.max(a3.x,b3.x),minY:Math.min(a3.y,b3.y),maxY:Math.max(a3.y,b3.y)}),midBetweenPointAndRect=(axis,p4,r5,eps=EPS22)=>axis==="x"?p4.x<r5.minX-eps?[(p4.x+r5.minX)/2]:p4.x>r5.maxX+eps?[(p4.x+r5.maxX)/2]:[r5.minX-.2,r5.maxX+.2]:p4.y<r5.minY-eps?[(p4.y+r5.minY)/2]:p4.y>r5.maxY+eps?[(p4.y+r5.maxY)/2]:[r5.minY-.2,r5.maxY+.2],candidateMidsFromSet=(axis,colliding,rectsById,collisionRectIds,aabb,eps=EPS22)=>{let setRects=[...collisionRectIds].map(id2=>rectsById.get(id2)).filter(r5=>!!r5);if(axis==="x"){let leftBoundaries=[aabb.minX,...setRects.map(r5=>r5.maxX)].filter(v4=>v4<colliding.minX-eps),rightBoundaries=[aabb.maxX,...setRects.map(r5=>r5.minX)].filter(v4=>v4>colliding.maxX+eps),leftNeighbor=leftBoundaries.length>0?Math.max(...leftBoundaries):void 0,rightNeighbor=rightBoundaries.length>0?Math.min(...rightBoundaries):void 0,out=[];return leftNeighbor!==void 0&&out.push((leftNeighbor+colliding.minX)/2),rightNeighbor!==void 0&&out.push((colliding.maxX+rightNeighbor)/2),out}else{let bottomBoundaries=[aabb.minY,...setRects.map(r5=>r5.maxY)].filter(v4=>v4<colliding.minY-eps),topBoundaries=[aabb.maxY,...setRects.map(r5=>r5.minY)].filter(v4=>v4>colliding.maxY+eps),bottomNeighbor=bottomBoundaries.length>0?Math.max(...bottomBoundaries):void 0,topNeighbor=topBoundaries.length>0?Math.min(...topBoundaries):void 0,out=[];return bottomNeighbor!==void 0&&out.push((bottomNeighbor+colliding.minY)/2),topNeighbor!==void 0&&out.push((colliding.maxY+topNeighbor)/2),out}},EPS3=1e-9,shiftSegmentOrth=(pts,segIndex,axis,newCoord,eps=EPS3)=>{if(segIndex<0||segIndex>=pts.length-1)return null;let a3=pts[segIndex],b3=pts[segIndex+1],vert=isVertical(a3,b3,eps),horz=isHorizontal(a3,b3,eps);if(!vert&&!horz||vert&&axis!=="x"||horz&&axis!=="y")return null;let out=pts.map(p4=>({...p4}));if(axis==="x"){if(Math.abs(a3.x-newCoord)<eps&&Math.abs(b3.x-newCoord)<eps)return null;out[segIndex]={...out[segIndex],x:newCoord},out[segIndex+1]={...out[segIndex+1],x:newCoord}}else{if(Math.abs(a3.y-newCoord)<eps&&Math.abs(b3.y-newCoord)<eps)return null;out[segIndex]={...out[segIndex],y:newCoord},out[segIndex+1]={...out[segIndex+1],y:newCoord}}if(segIndex-1>=0){let p4=out[segIndex-1],q4=out[segIndex];if(Math.abs(p4.x-q4.x)+Math.abs(p4.y-q4.y)<eps)return null}if(segIndex+2<=out.length-1){let p4=out[segIndex+1],q4=out[segIndex+2];if(Math.abs(p4.x-q4.x)+Math.abs(p4.y-q4.y)<eps)return null}for(let i3=0;i3<out.length-1;i3++){let u5=out[i3],v4=out[i3+1];if(!isHorizontal(u5,v4,eps)&&!isVertical(u5,v4,eps))return null}return out},pathKey=(pts,decimals=6)=>pts.map(p4=>`${p4.x.toFixed(decimals)},${p4.y.toFixed(decimals)}`).join("|"),SchematicTraceSingleLineSolver2=class extends BaseSolver5{constructor(params){super();__publicField(this,"pins");__publicField(this,"inputProblem");__publicField(this,"chipMap");__publicField(this,"obstacles");__publicField(this,"rectById");__publicField(this,"aabb");__publicField(this,"baseElbow");__publicField(this,"solvedTracePath",null);__publicField(this,"queue",[]);__publicField(this,"visited",new Set);this.pins=params.pins,this.inputProblem=params.inputProblem,this.chipMap=params.chipMap;for(let pin of this.pins)if(!pin._facingDirection){let chip=this.chipMap[pin.chipId];pin._facingDirection=getPinDirection2(pin,chip)}this.obstacles=getObstacleRects(this.inputProblem),this.rectById=new Map(this.obstacles.map(r5=>[r5.chipId,r5]));let[pin1,pin2]=this.pins;this.baseElbow=calculateElbow({x:pin1.x,y:pin1.y,facingDirection:pin1._facingDirection},{x:pin2.x,y:pin2.y,facingDirection:pin2._facingDirection},{overshoot:.2}),this.aabb=aabbFromPoints({x:pin1.x,y:pin1.y},{x:pin2.x,y:pin2.y}),this.queue.push({path:this.baseElbow,collisionChipIds:new Set}),this.visited.add(pathKey(this.baseElbow))}getConstructorParams(){return{chipMap:this.chipMap,pins:this.pins,inputProblem:this.inputProblem}}axisOfSegment(a3,b3){return isVertical(a3,b3)?"x":isHorizontal(a3,b3)?"y":null}pathLength(pts){let sum=0;for(let i3=0;i3<pts.length-1;i3++)sum+=Math.abs(pts[i3+1].x-pts[i3].x)+Math.abs(pts[i3+1].y-pts[i3].y);return sum}_step(){if(this.solvedTracePath){this.solved=!0;return}let state2=this.queue.shift();if(!state2){this.failed=!0,this.error="No collision-free path found";return}let{path,collisionChipIds}=state2,[PA2,PB]=this.pins,collision=findFirstCollision(path,this.obstacles);if(!collision){let first=path[0],last=path[path.length-1],EPS92=1e-9,samePoint2=(p4,q4)=>Math.abs(p4.x-q4.x)<EPS92&&Math.abs(p4.y-q4.y)<EPS92;samePoint2(first,{x:PA2.x,y:PA2.y})&&samePoint2(last,{x:PB.x,y:PB.y})&&(this.solvedTracePath=path,this.solved=!0);return}let{segIndex,rect}=collision,isFirstSegment=segIndex===0,isLastSegment=segIndex===path.length-2;if(isFirstSegment){if(path.length<3)return;segIndex=1}else if(isLastSegment){if(path.length<3)return;segIndex=path.length-3}let a3=path[segIndex],b3=path[segIndex+1],axis=this.axisOfSegment(a3,b3);if(!axis)return;let candidates=[];if(collisionChipIds.size===0){let m12=midBetweenPointAndRect(axis,{x:PA2.x,y:PA2.y},rect),m22=midBetweenPointAndRect(axis,{x:PB.x,y:PB.y},rect),allCandidates=[...m12,...m22],uniqueCandidates=[...new Set(allCandidates)];candidates.push(...uniqueCandidates)}else{let mids=candidateMidsFromSet(axis,rect,this.rectById,collisionChipIds,this.aabb);candidates.push(...mids)}let newStates=[];for(let coord of candidates){let newPath=shiftSegmentOrth(path,segIndex,axis,coord);if(!newPath)continue;let key=pathKey(newPath);if(this.visited.has(key))continue;this.visited.add(key);let nextSet=new Set(collisionChipIds);nextSet.add(rect.chipId);let len=this.pathLength(newPath);newStates.push({path:newPath,collisionRectIds:nextSet,len})}newStates.sort((a22,b22)=>a22.len-b22.len);for(let st3 of newStates)this.queue.push({path:st3.path,collisionChipIds:st3.collisionRectIds})}visualize(){let g6=visualizeInputProblem2(this.inputProblem,{chipAlpha:.1,connectionAlpha:.1});g6.lines.push({points:this.baseElbow,strokeColor:"red",strokeDash:"4 4"});let[pin1,pin2]=this.pins;g6.lines.push({points:[{x:pin1.x,y:pin1.y},{x:pin2.x,y:pin2.y}],strokeColor:"blue",strokeDash:"5 5"});for(let{path,collisionChipIds:collisionRectIds}of this.queue)g6.lines.push({points:path,strokeColor:"teal",strokeDash:"2 2"});return this.solvedTracePath?g6.lines.push({points:this.solvedTracePath,strokeColor:"green"}):this.queue.length>0&&g6.lines.push({points:this.queue[0].path,strokeColor:"orange"}),g6}},SchematicTraceLinesSolver=class extends BaseSolver5{constructor(params){super();__publicField(this,"inputProblem");__publicField(this,"mspConnectionPairs");__publicField(this,"dcConnMap");__publicField(this,"globalConnMap");__publicField(this,"queuedConnectionPairs");__publicField(this,"chipMap");__publicField(this,"currentConnectionPair",null);__publicField(this,"solvedTracePaths",[]);__publicField(this,"failedConnectionPairs",[]);this.inputProblem=params.inputProblem,this.mspConnectionPairs=params.mspConnectionPairs,this.dcConnMap=params.dcConnMap,this.globalConnMap=params.globalConnMap,this.chipMap=params.chipMap,this.queuedConnectionPairs=[...this.mspConnectionPairs]}getConstructorParams(){return{inputProblem:this.inputProblem,chipMap:this.chipMap,mspConnectionPairs:this.mspConnectionPairs,dcConnMap:this.dcConnMap,globalConnMap:this.globalConnMap}}_step(){if(this.activeSubSolver?.solved&&(this.solvedTracePaths.push({...this.currentConnectionPair,tracePath:this.activeSubSolver.solvedTracePath,mspConnectionPairIds:[this.currentConnectionPair.mspPairId],pinIds:[this.currentConnectionPair.pins[0].pinId,this.currentConnectionPair.pins[1].pinId]}),this.activeSubSolver=null,this.currentConnectionPair=null),this.activeSubSolver?.failed&&(this.currentConnectionPair&&this.failedConnectionPairs.push({...this.currentConnectionPair,error:this.activeSubSolver.error||void 0}),this.activeSubSolver=null,this.currentConnectionPair=null),this.activeSubSolver){this.activeSubSolver.step();return}let connectionPair=this.queuedConnectionPairs.shift();if(!connectionPair){this.solved=!0;return}this.currentConnectionPair=connectionPair;let{pins}=connectionPair;this.activeSubSolver=new SchematicTraceSingleLineSolver2({inputProblem:this.inputProblem,pins,chipMap:this.chipMap})}visualize(){if(this.activeSubSolver)return this.activeSubSolver.visualize();let graphics=visualizeInputProblem2(this.inputProblem,{chipAlpha:.1,connectionAlpha:.1});for(let{mspPairId,tracePath}of this.solvedTracePaths)graphics.lines.push({points:tracePath,strokeColor:"green"});for(let pair of this.failedConnectionPairs)graphics.lines.push({points:[{x:pair.pins[0].x,y:pair.pins[0].y},{x:pair.pins[1].x,y:pair.pins[1].y}],strokeColor:"red",strokeDash:"4 2"});return graphics}},applyJogToTerminalSegment=({pts,segmentIndex:si3,offset,JOG_SIZE,EPS:EPS92=1e-6})=>{if(si3!==0&&si3!==pts.length-2)return;let start=pts[si3],end=pts[si3+1],isVertical4=Math.abs(start.x-end.x)<EPS92,isHorizontal3=Math.abs(start.y-end.y)<EPS92;if(!isVertical4&&!isHorizontal3)return;let segDir=isVertical4?end.y>start.y?1:-1:end.x>start.x?1:-1;if(si3===0)if(isVertical4){let jogY=start.y+segDir*JOG_SIZE;pts.splice(1,1,{x:start.x,y:jogY},{x:start.x+offset,y:jogY},{x:end.x+offset,y:end.y})}else{let jogX=start.x+segDir*JOG_SIZE;pts.splice(1,1,{x:jogX,y:start.y},{x:jogX,y:start.y+offset},{x:end.x,y:end.y+offset})}else if(isVertical4){let jogY=end.y-segDir*JOG_SIZE;pts.splice(si3,1,{x:start.x+offset,y:start.y},{x:end.x+offset,y:jogY},{x:end.x,y:jogY})}else{let jogX=end.x-segDir*JOG_SIZE;pts.splice(si3,1,{x:start.x,y:start.y+offset},{x:jogX,y:end.y+offset},{x:jogX,y:end.y})}},TraceOverlapIssueSolver=class extends BaseSolver5{constructor(params){super();__publicField(this,"overlappingTraceSegments");__publicField(this,"traceNetIslands");__publicField(this,"SHIFT_DISTANCE",.1);__publicField(this,"correctedTraceMap",{});this.overlappingTraceSegments=params.overlappingTraceSegments,this.traceNetIslands=params.traceNetIslands;for(let{connNetId,pathsWithOverlap}of this.overlappingTraceSegments)for(let{solvedTracePathIndex,traceSegmentIndex}of pathsWithOverlap){let mspPairId=this.traceNetIslands[connNetId][solvedTracePathIndex].mspPairId;this.correctedTraceMap[mspPairId]=this.traceNetIslands[connNetId][solvedTracePathIndex]}}_step(){let offsets=this.overlappingTraceSegments.map((_4,idx)=>{let n4=Math.floor(idx/2)+1;return(idx%2===0?-n4:n4)*this.SHIFT_DISTANCE}),eq=(a3,b3)=>Math.abs(a3-b3)<1e-6,samePoint2=(p4,q4)=>!!p4&&!!q4&&eq(p4.x,q4.x)&&eq(p4.y,q4.y);this.overlappingTraceSegments.forEach((group,gidx)=>{let offset=offsets[gidx],byPath=new Map;for(let loc of group.pathsWithOverlap)byPath.has(loc.solvedTracePathIndex)||byPath.set(loc.solvedTracePathIndex,new Set),byPath.get(loc.solvedTracePathIndex).add(loc.traceSegmentIndex);for(let[pathIdx,segIdxSet]of byPath){let original=this.traceNetIslands[group.connNetId][pathIdx],current3=this.correctedTraceMap[original.mspPairId]??original,pts=current3.tracePath.map(p4=>({...p4})),segIdxs=Array.from(segIdxSet).sort((a3,b3)=>a3-b3),segIdxsRev=Array.from(segIdxSet).sort((a3,b3)=>a3-b3).reverse(),JOG_SIZE=this.SHIFT_DISTANCE;for(let si3 of segIdxsRev)if(!(si3<0||si3>=pts.length-1))if(si3===0||si3===pts.length-2)applyJogToTerminalSegment({pts,segmentIndex:si3,offset,JOG_SIZE,EPS:1e-6});else{let start=pts[si3],end=pts[si3+1],isVertical4=Math.abs(start.x-end.x)<1e-6,isHorizontal3=Math.abs(start.y-end.y)<1e-6;if(!isVertical4&&!isHorizontal3)continue;isVertical4?(start.x+=offset,end.x+=offset):(start.y+=offset,end.y+=offset)}let cleaned=[];for(let p4 of pts)(cleaned.length===0||!samePoint2(cleaned[cleaned.length-1],p4))&&cleaned.push(p4);this.correctedTraceMap[original.mspPairId]={...current3,tracePath:cleaned}}}),this.solved=!0}visualize(){let graphics={lines:[],points:[],rects:[],circles:[]};for(let group of this.overlappingTraceSegments)for(let{solvedTracePathIndex,traceSegmentIndex}of group.pathsWithOverlap){let path=this.traceNetIslands[group.connNetId][solvedTracePathIndex],segStart=path.tracePath[traceSegmentIndex],segEnd=path.tracePath[traceSegmentIndex+1];graphics.lines.push({points:[segStart,segEnd],strokeColor:"red"})}for(let trace of Object.values(this.correctedTraceMap))graphics.lines.push({points:trace.tracePath,strokeColor:"blue",strokeDash:"4 2"});return graphics}},TraceOverlapShiftSolver=class extends BaseSolver5{constructor(params){super();__publicField(this,"inputProblem");__publicField(this,"inputTracePaths");__publicField(this,"globalConnMap");__publicField(this,"traceNetIslands",{});__publicField(this,"correctedTraceMap",{});__publicField(this,"cleanupPhase",null);this.inputProblem=params.inputProblem,this.inputTracePaths=params.inputTracePaths,this.globalConnMap=params.globalConnMap;for(let tracePath of this.inputTracePaths){let{mspPairId}=tracePath;this.correctedTraceMap[mspPairId]=tracePath}this.traceNetIslands=this.computeTraceNetIslands()}getConstructorParams(){return{inputProblem:this.inputProblem,inputTracePaths:this.inputTracePaths,globalConnMap:this.globalConnMap}}computeTraceNetIslands(){let islands={};for(let original of this.inputTracePaths){let path=this.correctedTraceMap[original.mspPairId]??original,key=path.globalConnNetId;islands[key]||(islands[key]=[]),islands[key].push(path)}return islands}findNextOverlapIssue(){let netIds=Object.keys(this.traceNetIslands);for(let i3=0;i3<netIds.length;i3++)for(let j4=i3+1;j4<netIds.length;j4++){let netA=netIds[i3],netB=netIds[j4],pathsA=this.traceNetIslands[netA]||[],pathsB=this.traceNetIslands[netB]||[],overlapsA=[],overlapsB=[],seenA=new Set,seenB=new Set,overlaps1D=(a12,a22,b12,b22)=>{let minA=Math.min(a12,a22),maxA=Math.max(a12,a22),minB=Math.min(b12,b22),maxB=Math.max(b12,b22);return Math.min(maxA,maxB)-Math.max(minA,minB)>.002};for(let pa3=0;pa3<pathsA.length;pa3++){let ptsA=pathsA[pa3].tracePath;for(let sa3=0;sa3<ptsA.length-1;sa3++){let a12=ptsA[sa3],a22=ptsA[sa3+1],aVert=Math.abs(a12.x-a22.x)<.002,aHorz=Math.abs(a12.y-a22.y)<.002;if(!(!aVert&&!aHorz))for(let pb2=0;pb2<pathsB.length;pb2++){let ptsB=pathsB[pb2].tracePath;for(let sb3=0;sb3<ptsB.length-1;sb3++){let b12=ptsB[sb3],b22=ptsB[sb3+1],bVert=Math.abs(b12.x-b22.x)<.002,bHorz=Math.abs(b12.y-b22.y)<.002;if(!(!bVert&&!bHorz)){if(aVert&&bVert){if(Math.abs(a12.x-b12.x)<.002&&overlaps1D(a12.y,a22.y,b12.y,b22.y)){let keyA=`${pa3}:${sa3}`,keyB=`${pb2}:${sb3}`;seenA.has(keyA)||(overlapsA.push({solvedTracePathIndex:pa3,traceSegmentIndex:sa3}),seenA.add(keyA)),seenB.has(keyB)||(overlapsB.push({solvedTracePathIndex:pb2,traceSegmentIndex:sb3}),seenB.add(keyB))}}else if(aHorz&&bHorz&&Math.abs(a12.y-b12.y)<.002&&overlaps1D(a12.x,a22.x,b12.x,b22.x)){let keyA=`${pa3}:${sa3}`,keyB=`${pb2}:${sb3}`;seenA.has(keyA)||(overlapsA.push({solvedTracePathIndex:pa3,traceSegmentIndex:sa3}),seenA.add(keyA)),seenB.has(keyB)||(overlapsB.push({solvedTracePathIndex:pb2,traceSegmentIndex:sb3}),seenB.add(keyB))}}}}}}if(overlapsA.length>0&&overlapsB.length>0)return{overlappingTraceSegments:[{connNetId:netA,pathsWithOverlap:overlapsA},{connNetId:netB,pathsWithOverlap:overlapsB}]}}return null}findNextDiagonalSegment(){for(let mspPairId in this.correctedTraceMap){let tracePath=this.correctedTraceMap[mspPairId].tracePath;for(let i3=0;i3<tracePath.length-1;i3++){let p12=tracePath[i3],p22=tracePath[i3+1],isHorizontal3=Math.abs(p12.y-p22.y)<.002,isVertical4=Math.abs(p12.x-p22.x)<.002;if(!isHorizontal3&&!isVertical4)return{mspPairId,tracePath,i:i3,p1:p12,p2:p22}}}return null}findAndFixNextDiagonalSegment(){let diagonalInfo=this.findNextDiagonalSegment();if(!diagonalInfo)return!1;let{mspPairId,tracePath,i:i3,p1:p12,p2:p22}=diagonalInfo,EPS92=.002,p02=i3>0?tracePath[i3-1]:null,p32=i3+2<tracePath.length?tracePath[i3+2]:null,prevIsVertical=p02?Math.abs(p02.x-p12.x)<EPS92:!1,prevIsHorizontal=p02?Math.abs(p02.y-p12.y)<EPS92:!1,nextIsVertical=p32?Math.abs(p22.x-p32.x)<EPS92:!1,nextIsHorizontal=p32?Math.abs(p22.y-p32.y)<EPS92:!1,elbow1={x:p12.x,y:p22.y},elbow2={x:p22.x,y:p12.y},score1=0;prevIsVertical&&score1++,nextIsHorizontal&&score1++;let score2=0;prevIsHorizontal&&score2++,nextIsVertical&&score2++;let elbowPoint=score1<score2?elbow1:elbow2;return tracePath.splice(i3+1,0,elbowPoint),!0}_step(){if(this.activeSubSolver?.solved){for(let[mspPairId,newTrace]of Object.entries(this.activeSubSolver.correctedTraceMap))this.correctedTraceMap[mspPairId]=newTrace;this.activeSubSolver=null,this.traceNetIslands=this.computeTraceNetIslands()}if(this.activeSubSolver){this.activeSubSolver.step();return}let overlapIssue=this.findNextOverlapIssue();if(overlapIssue===null){if(this.cleanupPhase===null&&(this.cleanupPhase="diagonals"),this.cleanupPhase==="diagonals"){this.findAndFixNextDiagonalSegment()||(this.cleanupPhase="done",this.solved=!0);return}this.solved=!0;return}let{overlappingTraceSegments}=overlapIssue;this.activeSubSolver=new TraceOverlapIssueSolver({overlappingTraceSegments,traceNetIslands:this.traceNetIslands})}visualize(){if(this.activeSubSolver)return this.activeSubSolver.visualize();let graphics=visualizeInputProblem2(this.inputProblem);graphics.circles=graphics.circles||[];for(let trace of Object.values(this.correctedTraceMap))graphics.lines.push({points:trace.tracePath,strokeColor:"purple"});if(this.cleanupPhase==="diagonals"){let diagonalInfo=this.findNextDiagonalSegment();diagonalInfo&&graphics.lines.push({points:[diagonalInfo.p1,diagonalInfo.p2],strokeColor:"red",strokeWidth:.05})}return graphics}},ChipObstacleSpatialIndex=class{constructor(chips){__publicField(this,"chips");__publicField(this,"spatialIndex");__publicField(this,"spatialIndexIdToChip");this.chips=chips.map(chip=>({...chip,bounds:getInputChipBounds(chip),spatialIndexId:null})),this.spatialIndexIdToChip=new Map,this.spatialIndex=new Flatbush(chips.length);for(let chip of this.chips)chip.spatialIndexId=this.spatialIndex.add(chip.bounds.minX,chip.bounds.minY,chip.bounds.maxX,chip.bounds.maxY),this.spatialIndexIdToChip.set(chip.spatialIndexId,chip);this.spatialIndex.finish()}getChipsInBounds(bounds){return this.spatialIndex.search(bounds.minX,bounds.minY,bounds.maxX,bounds.maxY).map(id2=>this.spatialIndexIdToChip.get(id2))}doesOrthogonalLineIntersectChip(line2,opts={}){let excludeChipIds=opts.excludeChipIds??[],[p12,p22]=line2,{x:x12,y:y12}=p12,{x:x22,y:y22}=p22;return this.getChipsInBounds({minX:Math.min(x12,x22),minY:Math.min(y12,y22),maxX:Math.max(x12,x22),maxY:Math.max(y12,y22)}).filter(chip=>!excludeChipIds.includes(chip.chipId)).length>0}},NET_LABEL_HORIZONTAL_WIDTH=.45,NET_LABEL_HORIZONTAL_HEIGHT=.2;function getDimsForOrientation(params){let{orientation:orientation4,netLabelWidth}=params,horizWidth=typeof netLabelWidth=="number"?netLabelWidth:NET_LABEL_HORIZONTAL_WIDTH;return orientation4==="y+"||orientation4==="y-"?{width:NET_LABEL_HORIZONTAL_HEIGHT,height:horizWidth}:{width:horizWidth,height:NET_LABEL_HORIZONTAL_HEIGHT}}function getCenterFromAnchor(anchor,orientation4,width,height){switch(orientation4){case"x+":return{x:anchor.x+width/2,y:anchor.y};case"x-":return{x:anchor.x-width/2,y:anchor.y};case"y+":return{x:anchor.x,y:anchor.y+height/2};case"y-":return{x:anchor.x,y:anchor.y-height/2}}}function getRectBounds(center2,w4,h6){return{minX:center2.x-w4/2,minY:center2.y-h6/2,maxX:center2.x+w4/2,maxY:center2.y+h6/2}}function segmentIntersectsRect2(p12,p22,rect,EPS92=1e-9){let isVert=Math.abs(p12.x-p22.x)<EPS92,isHorz=Math.abs(p12.y-p22.y)<EPS92;if(!isVert&&!isHorz)return!1;if(isVert){let x4=p12.x;if(x4<rect.minX-EPS92||x4>rect.maxX+EPS92)return!1;let segMinY=Math.min(p12.y,p22.y),segMaxY=Math.max(p12.y,p22.y);return Math.min(segMaxY,rect.maxY)-Math.max(segMinY,rect.minY)>EPS92}else{let y4=p12.y;if(y4<rect.minY-EPS92||y4>rect.maxY+EPS92)return!1;let segMinX=Math.min(p12.x,p22.x),segMaxX=Math.max(p12.x,p22.x);return Math.min(segMaxX,rect.maxX)-Math.max(segMinX,rect.minX)>EPS92}}function rectIntersectsAnyTrace(bounds,inputTraceMap,hostPathId,hostSegIndex){for(let[pairId,solved]of Object.entries(inputTraceMap)){let pts=solved.tracePath;for(let i3=0;i3<pts.length-1;i3++)if(!(pairId===hostPathId&&i3===hostSegIndex)&&segmentIntersectsRect2(pts[i3],pts[i3+1],bounds))return{hasIntersection:!0,mspPairId:pairId,segIndex:i3}}return{hasIntersection:!1}}function lengthOfTrace(path){let sum=0,pts=path.tracePath;for(let i3=0;i3<pts.length-1;i3++)sum+=Math.abs(pts[i3+1].x-pts[i3].x)+Math.abs(pts[i3+1].y-pts[i3].y);return sum}function chooseHostTraceForGroup(params){let{inputProblem,inputTraceMap,globalConnNetId,fallbackTrace,mspConnectionPairIds}=params,chipsById=Object.fromEntries(inputProblem.chips.map(c4=>[c4.chipId,c4])),groupTraces=Object.values(inputTraceMap).filter(t52=>t52.globalConnNetId===globalConnNetId);if(mspConnectionPairIds&&mspConnectionPairIds.length>0){let idSet=new Set(mspConnectionPairIds);groupTraces=groupTraces.filter(t52=>t52.mspConnectionPairIds.some(id2=>idSet.has(id2)))}let chipIdsInGroup=new Set;for(let t52 of groupTraces)chipIdsInGroup.add(t52.pins[0].chipId),chipIdsInGroup.add(t52.pins[1].chipId);let largestChipId=null,largestPinCount=-1;for(let id2 of chipIdsInGroup){let count=chipsById[id2]?.pins?.length??0;count>largestPinCount&&(largestPinCount=count,largestChipId=id2)}let hostCandidates=largestChipId==null?[]:groupTraces.filter(t52=>t52.pins[0].chipId===largestChipId||t52.pins[1].chipId===largestChipId);return hostCandidates.length>0?hostCandidates.reduce((a3,b3)=>lengthOfTrace(a3)>=lengthOfTrace(b3)?a3:b3):fallbackTrace}function anchorsForSegment(a3,b3){return[{x:a3.x,y:a3.y},{x:(a3.x+b3.x)/2,y:(a3.y+b3.y)/2},{x:b3.x,y:b3.y}]}function solveNetLabelPlacementForPortOnlyPin(params){let{inputProblem,inputTraceMap,chipObstacleSpatialIndex,overlappingSameNetTraceGroup,availableOrientations,netLabelWidth}=params,pinId=overlappingSameNetTraceGroup.portOnlyPinId;if(!pinId)return{placement:null,testedCandidates:[],error:"No portOnlyPinId provided"};let pin=null,pinFacingDirection=null;for(let chip of inputProblem.chips){let p4=chip.pins.find(pp3=>pp3.pinId===pinId);if(p4){pin={x:p4.x,y:p4.y},pinFacingDirection=p4._facingDirection||getPinDirection2(p4,chip);break}}if(!pin||!pinFacingDirection)return{placement:null,testedCandidates:[],error:`Port-only pin not found: ${pinId}`};let orientations=availableOrientations.length>0?availableOrientations:["x+","x-","y+","y-"],anchor={x:pin.x,y:pin.y},outwardOf=o4=>o4==="x+"?{x:1,y:0}:o4==="x-"?{x:-1,y:0}:o4==="y+"?{x:0,y:1}:{x:0,y:-1},testedCandidates=[];for(let orientation4 of orientations){let{width:width2,height:height2}=getDimsForOrientation({orientation:orientation4,netLabelWidth}),baseCenter2=getCenterFromAnchor(anchor,orientation4,width2,height2),outward2=outwardOf(orientation4),offset2=.001,center2={x:baseCenter2.x+outward2.x*offset2,y:baseCenter2.y+outward2.y*offset2},bounds=getRectBounds(center2,width2,height2);if(chipObstacleSpatialIndex.getChipsInBounds(bounds).length>0){testedCandidates.push({center:center2,width:width2,height:height2,bounds,anchor,orientation:orientation4,status:"chip-collision",hostSegIndex:-1});continue}if(rectIntersectsAnyTrace(bounds,inputTraceMap,"",-1).hasIntersection){testedCandidates.push({center:center2,width:width2,height:height2,bounds,anchor,orientation:orientation4,status:"trace-collision",hostSegIndex:-1});continue}return testedCandidates.push({center:center2,width:width2,height:height2,bounds,anchor,orientation:orientation4,status:"ok",hostSegIndex:-1}),{placement:{globalConnNetId:overlappingSameNetTraceGroup.globalConnNetId,dcConnNetId:void 0,netId:overlappingSameNetTraceGroup.netId,mspConnectionPairIds:[],pinIds:[pinId],orientation:orientation4,anchorPoint:anchor,width:width2,height:height2,center:center2},testedCandidates}}let fallbackOrientation=pinFacingDirection,{width,height}=getDimsForOrientation({orientation:fallbackOrientation,netLabelWidth}),baseCenter=getCenterFromAnchor(anchor,fallbackOrientation,width,height),outward=outwardOf(fallbackOrientation),offset=.001,fallbackCenter={x:baseCenter.x+outward.x*offset,y:baseCenter.y+outward.y*offset};return{placement:{globalConnNetId:overlappingSameNetTraceGroup.globalConnNetId,dcConnNetId:void 0,netId:overlappingSameNetTraceGroup.netId,mspConnectionPairIds:[],pinIds:[pinId],orientation:fallbackOrientation,anchorPoint:anchor,width,height,center:fallbackCenter},testedCandidates}}function visualizeSingleNetLabelPlacementSolver(solver){let graphics=visualizeInputProblem2(solver.inputProblem),groupId=solver.overlappingSameNetTraceGroup.globalConnNetId,host=chooseHostTraceForGroup({inputProblem:solver.inputProblem,inputTraceMap:solver.inputTraceMap,globalConnNetId:groupId,fallbackTrace:solver.overlappingSameNetTraceGroup.overlappingTraces}),groupStroke=getColorFromString2(groupId,.9),groupFill=getColorFromString2(groupId,.5);for(let trace of Object.values(solver.inputTraceMap)){let isHost=host?trace.mspPairId===host.mspPairId:!1;graphics.lines.push({points:trace.tracePath})}for(let c4 of solver.testedCandidates){let fill=c4.status==="ok"?"rgba(0, 180, 0, 0.25)":c4.status==="chip-collision"?"rgba(220, 0, 0, 0.25)":c4.status==="trace-collision"?"rgba(220, 140, 0, 0.25)":"rgba(120, 120, 120, 0.15)",stroke=c4.status==="ok"?"green":c4.status==="chip-collision"?"red":c4.status==="trace-collision"?"orange":"gray",candidateLabel=c4.status==="ok"?"status: ok(valid net label candidate)":c4.status==="chip-collision"?"status: chip-collision":c4.status==="trace-collision"?"status: trace-collision":"status: parallel-to-segment";graphics.rects.push({center:{x:(c4.bounds.minX+c4.bounds.maxX)/2,y:(c4.bounds.minY+c4.bounds.maxY)/2},width:c4.width,height:c4.height,fill,strokeColor:stroke,label:`${candidateLabel}
|
|
650
651
|
orientation: ${c4.orientation}`}),graphics.points.push({x:c4.anchor.x,y:c4.anchor.y,color:stroke,label:`anchor
|
|
651
652
|
orientation: ${c4.orientation}`})}if(solver.netLabelPlacement){let p4=solver.netLabelPlacement;graphics.rects.push({center:p4.center,width:p4.width,height:p4.height,fill:"rgba(0, 128, 255, 0.35)",strokeColor:"blue",label:`netId: ${p4.netId}
|
|
652
653
|
globalConnNetId: ${p4.globalConnNetId}`}),graphics.points.push({x:p4.anchorPoint.x,y:p4.anchorPoint.y,color:"blue",label:`anchor
|
|
@@ -705,7 +706,7 @@ ${spiceString}`)}catch(error2){debug10(`Failed to convert circuit JSON to SPICE:
|
|
|
705
706
|
`+filler+` |
|
|
706
707
|
`+offset_s.line+" | "+line2+`
|
|
707
708
|
`+filler+" | "+peg$padEnd3("",s3.column-1," ")+peg$padEnd3("",hatLen,"^")}else str+=`
|
|
708
|
-
at `+loc}return str};peg$SyntaxError3.buildMessage=function(expected,found){var DESCRIBE_EXPECTATION_FNS={literal:function(expectation){return'"'+literalEscape(expectation.text)+'"'},class:function(expectation){var escapedParts=expectation.parts.map(function(part){return Array.isArray(part)?classEscape(part[0])+"-"+classEscape(part[1]):classEscape(part)});return"["+(expectation.inverted?"^":"")+escapedParts.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(expectation){return expectation.description}};function hex(ch3){return ch3.charCodeAt(0).toString(16).toUpperCase()}function literalEscape(s3){return s3.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch3){return"\\x0"+hex(ch3)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch3){return"\\x"+hex(ch3)})}function classEscape(s3){return s3.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch3){return"\\x0"+hex(ch3)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch3){return"\\x"+hex(ch3)})}function describeExpectation(expectation){return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation)}function describeExpected(expected2){var descriptions=expected2.map(describeExpectation),i3,j4;if(descriptions.sort(),descriptions.length>0){for(i3=1,j4=1;i3<descriptions.length;i3++)descriptions[i3-1]!==descriptions[i3]&&(descriptions[j4]=descriptions[i3],j4++);descriptions.length=j4}switch(descriptions.length){case 1:return descriptions[0];case 2:return descriptions[0]+" or "+descriptions[1];default:return descriptions.slice(0,-1).join(", ")+", or "+descriptions[descriptions.length-1]}}function describeFound(found2){return found2?'"'+literalEscape(found2)+'"':"end of input"}return"Expected "+describeExpected(expected)+" but "+describeFound(found)+" found."};function decomposeTSR3(matrix2,flipX=!1,flipY2=!1){flipX?flipY2?matrix2=compose4(matrix2,scale4(-1,-1)):matrix2=compose4(matrix2,scale4(1,-1)):flipY2&&(matrix2=compose4(matrix2,scale4(-1,1)));let a3=matrix2.a,b3=matrix2.b,c4=matrix2.c,d4=matrix2.d,scaleX,scaleY,rotation22;if(a3!==0||c4!==0){let hypotAc=Math.hypot(a3,c4);scaleX=hypotAc,scaleY=(a3*d4-b3*c4)/hypotAc;let acos=Math.acos(a3/hypotAc);rotation22=c4>0?-acos:acos}else if(b3!==0||d4!==0){let hypotBd=Math.hypot(b3,d4);scaleX=(a3*d4-b3*c4)/hypotBd,scaleY=hypotBd;let acos=Math.acos(b3/hypotBd);rotation22=Math.PI/2+(d4>0?-acos:acos)}else scaleX=0,scaleY=0,rotation22=0;return flipY2&&(scaleX=-scaleX),flipX&&(scaleY=-scaleY),{translate:{tx:matrix2.e,ty:matrix2.f},scale:{sx:scaleX,sy:scaleY},rotation:{angle:rotation22}}}function connect2(map,a3,b3){if(!a3||!b3)return;let setA=map.get(a3);setA||(setA=new Set,map.set(a3,setA)),setA.add(b3);let setB=map.get(b3);setB||(setB=new Set,map.set(b3,setB)),setB.add(a3)}function buildSubtree2(soup,opts){if(!opts.subcircuit_id&&!opts.source_group_id)return[...soup];let effectiveOpts=opts;if(opts.subcircuit_id){let subcircuitIds=new Set([opts.subcircuit_id]),groupChildren=new Map,groupSubcircuit=new Map;for(let elm of soup)if(elm.type==="source_group"){let groupId=elm.source_group_id,subcircuitId=elm.subcircuit_id;subcircuitId&&groupSubcircuit.set(groupId,subcircuitId);let parentId=elm.parent_source_group_id;parentId&&(groupChildren.has(parentId)||groupChildren.set(parentId,[]),groupChildren.get(parentId).push(groupId))}let rootGroupId;for(let[groupId,subcircuitId]of groupSubcircuit)if(subcircuitId===opts.subcircuit_id){rootGroupId=groupId;break}if(rootGroupId){let collectChildSubcircuits=groupId=>{let children=groupChildren.get(groupId)||[];for(let childId of children){let childSubcircuit=groupSubcircuit.get(childId);childSubcircuit&&subcircuitIds.add(childSubcircuit),collectChildSubcircuits(childId)}};collectChildSubcircuits(rootGroupId),effectiveOpts={...opts,subcircuit_ids:Array.from(subcircuitIds)}}}let idMap=new Map;for(let elm of soup){let idKey=`${elm.type}_id`,idVal=elm[idKey];typeof idVal=="string"&&idMap.set(idVal,elm)}let adj=new Map;for(let elm of soup){let entries=Object.entries(elm);for(let[key,val]of entries)if(key!=="parent_source_group_id"){if(key.endsWith("_id")&&typeof val=="string"){let other=idMap.get(val);connect2(adj,elm,other)}else if(key.endsWith("_ids")&&Array.isArray(val)){for(let v4 of val)if(typeof v4=="string"){let other=idMap.get(v4);connect2(adj,elm,other)}}}}let queue=[],included=new Set;for(let elm of soup){let shouldInclude=!1;(effectiveOpts.subcircuit_id&&"subcircuit_id"in elm&&elm.subcircuit_id===effectiveOpts.subcircuit_id||effectiveOpts.subcircuit_ids&&"subcircuit_id"in elm&&elm.subcircuit_id&&effectiveOpts.subcircuit_ids.includes(elm.subcircuit_id)||effectiveOpts.source_group_id&&"source_group_id"in elm&&elm.source_group_id===effectiveOpts.source_group_id||effectiveOpts.source_group_id&&"member_source_group_ids"in elm&&Array.isArray(elm.member_source_group_ids)&&elm.member_source_group_ids.includes(effectiveOpts.source_group_id))&&(shouldInclude=!0),shouldInclude&&(queue.push(elm),included.add(elm))}for(;queue.length>0;){let elm=queue.shift(),neighbors=adj.get(elm);if(neighbors)for(let n4 of neighbors)included.has(n4)||(included.add(n4),queue.push(n4))}return soup.filter(e5=>included.has(e5))}var cju2=(circuitJsonInput,options={})=>{let circuitJson=circuitJsonInput,internalStore=circuitJson._internal_store;if(!internalStore){internalStore={counts:{},editCount:0},circuitJson._internal_store=internalStore;for(let elm of circuitJson){let type=elm.type,idVal=elm[`${type}_id`];if(!idVal)continue;let idNum=Number.parseInt(idVal.split("_").pop());Number.isNaN(idNum)||(internalStore.counts[type]=Math.max(internalStore.counts[type]??0,idNum))}}let su22=new Proxy({},{get:(proxy_target,prop)=>{if(prop==="toArray")return()=>(circuitJson.editCount=internalStore.editCount,circuitJson);if(prop==="editCount")return internalStore.editCount;if(prop==="subtree")return opts=>cju2(buildSubtree2(circuitJson,opts),options);if(prop==="insert")return elm=>{var _a415;let component_type2=elm.type;if(!component_type2)throw new Error("insert requires an element with a type");(_a415=internalStore.counts)[component_type2]??(_a415[component_type2]=-1),internalStore.counts[component_type2]++;let index=internalStore.counts[component_type2],newElm={...elm,type:component_type2,[`${component_type2}_id`]:`${component_type2}_${index}`};return options.validateInserts&&(dist_exports6[component_type2]??any_soup_element2).parse(newElm),circuitJson.push(newElm),internalStore.editCount++,newElm};if(prop==="insertAll")return elms=>elms.map(elm=>su22.insert(elm));let component_type=prop;return{get:id2=>circuitJson.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===id2),getUsing:using=>{let keys=Object.keys(using);if(keys.length!==1)throw new Error("getUsing requires exactly one key, e.g. { pcb_component_id }");let join_key=keys[0],join_type=join_key.replace("_id",""),joiner=circuitJson.find(e5=>e5.type===join_type&&e5[join_key]===using[join_key]);return joiner?circuitJson.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===joiner[`${component_type}_id`]):null},getWhere:where=>{let keys=Object.keys(where);return circuitJson.find(e5=>e5.type===component_type&&keys.every(key=>e5[key]===where[key]))},list:where=>{let keys=where?Object.keys(where):[];return circuitJson.filter(e5=>e5.type===component_type&&keys.every(key=>e5[key]===where[key]))},insert:elm=>{var _a415;(_a415=internalStore.counts)[component_type]??(_a415[component_type]=-1),internalStore.counts[component_type]++;let index=internalStore.counts[component_type],newElm={type:component_type,[`${component_type}_id`]:`${component_type}_${index}`,...elm};return options.validateInserts&&(dist_exports6[component_type]??any_soup_element2).parse(newElm),circuitJson.push(newElm),internalStore.editCount++,newElm},delete:id2=>{let elm=circuitJson.find(e5=>e5[`${component_type}_id`]===id2);elm&&(circuitJson.splice(circuitJson.indexOf(elm),1),internalStore.editCount++)},update:(id2,newProps)=>{let elm=circuitJson.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===id2);return elm?(Object.assign(elm,newProps),internalStore.editCount++,elm):null},select:selector=>{if(component_type==="source_component")return circuitJson.find(e5=>e5.type==="source_component"&&e5.name===selector.replace(/\./g,""));if(component_type==="pcb_port"||component_type==="source_port"||component_type==="schematic_port"){let[component_name,port_selector]=selector.replace(/\./g,"").split(/[\s\>]+/),source_component=circuitJson.find(e5=>e5.type==="source_component"&&e5.name===component_name);if(!source_component)return null;let source_port22=circuitJson.find(e5=>e5.type==="source_port"&&e5.source_component_id===source_component.source_component_id&&(e5.name===port_selector||(e5.port_hints??[]).includes(port_selector)));if(!source_port22)return null;if(component_type==="source_port")return source_port22;if(component_type==="pcb_port")return circuitJson.find(e5=>e5.type==="pcb_port"&&e5.source_port_id===source_port22.source_port_id);if(component_type==="schematic_port")return circuitJson.find(e5=>e5.type==="schematic_port"&&e5.source_port_id===source_port22.source_port_id)}}}}});return su22};cju2.unparsed=cju2;function createIdKey2(element){let type=element.type;return`${type}:${element[`${type}_id`]}`}var cjuIndexed2=(soup,options={})=>{let internalStore=soup._internal_store_indexed;if(!internalStore){internalStore={counts:{},editCount:0,indexes:{}};for(let elm of soup){let type=elm.type,idVal=elm[`${type}_id`];if(!idVal)continue;let idNum=Number.parseInt(idVal.split("_").pop()||"");Number.isNaN(idNum)||(internalStore.counts[type]=Math.max(internalStore.counts[type]??0,idNum))}let indexConfig=options.indexConfig||{},indexes=internalStore.indexes;if(indexConfig.byId&&(indexes.byId=new Map),indexConfig.byType&&(indexes.byType=new Map),indexConfig.byRelation&&(indexes.byRelation=new Map),indexConfig.bySubcircuit&&(indexes.bySubcircuit=new Map),indexConfig.byCustomField&&indexConfig.byCustomField.length>0){indexes.byCustomField=new Map;for(let field of indexConfig.byCustomField)indexes.byCustomField.set(field,new Map)}for(let element of soup){if(indexConfig.byId){let idKey=createIdKey2(element);indexes.byId.set(idKey,element)}if(indexConfig.byType){let elementsOfType=indexes.byType.get(element.type)||[];elementsOfType.push(element),indexes.byType.set(element.type,elementsOfType)}if(indexConfig.byRelation){let elementEntries=Object.entries(element);for(let[key,value]of elementEntries)if(key.endsWith("_id")&&key!==`${element.type}_id`&&typeof value=="string"){let relationTypeMap=indexes.byRelation.get(key)||new Map,relatedElements=relationTypeMap.get(value)||[];relatedElements.push(element),relationTypeMap.set(value,relatedElements),indexes.byRelation.set(key,relationTypeMap)}}if(indexConfig.bySubcircuit&&"subcircuit_id"in element){let subcircuitId=element.subcircuit_id;if(subcircuitId&&typeof subcircuitId=="string"){let subcircuitElements=indexes.bySubcircuit.get(subcircuitId)||[];subcircuitElements.push(element),indexes.bySubcircuit.set(subcircuitId,subcircuitElements)}}if(indexConfig.byCustomField&&indexes.byCustomField){for(let field of indexConfig.byCustomField)if(field in element){let fieldValue=element[field];if(fieldValue!==void 0&&(typeof fieldValue=="string"||typeof fieldValue=="number")){let fieldValueStr=String(fieldValue),fieldMap=indexes.byCustomField.get(field),elementsWithFieldValue=fieldMap.get(fieldValueStr)||[];elementsWithFieldValue.push(element),fieldMap.set(fieldValueStr,elementsWithFieldValue)}}}}soup._internal_store_indexed=internalStore}return new Proxy({},{get:(proxy_target,prop)=>{if(prop==="toArray")return()=>(soup.editCount=internalStore.editCount,soup);if(prop==="editCount")return internalStore.editCount;let component_type=prop;return{get:id2=>{let indexConfig=options.indexConfig||{};return indexConfig.byId&&internalStore.indexes.byId?internalStore.indexes.byId.get(`${component_type}:${id2}`)||null:indexConfig.byType&&internalStore.indexes.byType?(internalStore.indexes.byType.get(component_type)||[]).find(e5=>e5[`${component_type}_id`]===id2)||null:soup.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===id2)||null},getUsing:using=>{let indexConfig=options.indexConfig||{},keys=Object.keys(using);if(keys.length!==1)throw new Error("getUsing requires exactly one key, e.g. { pcb_component_id }");let join_key=keys[0],join_type=join_key.replace("_id","");if(indexConfig.byRelation&&internalStore.indexes.byRelation){let relationMap=internalStore.indexes.byRelation.get(join_key);if(relationMap){let joiner2=(relationMap.get(using[join_key])||[]).find(e5=>e5.type===join_type);if(!joiner2)return null;let joinerId=joiner2[`${component_type}_id`];return indexConfig.byId&&internalStore.indexes.byId?internalStore.indexes.byId.get(`${component_type}:${joinerId}`)||null:indexConfig.byType&&internalStore.indexes.byType?(internalStore.indexes.byType.get(component_type)||[]).find(e5=>e5[`${component_type}_id`]===joinerId)||null:soup.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===joinerId)||null}}let joiner=soup.find(e5=>e5.type===join_type&&e5[join_key]===using[join_key]);return joiner&&soup.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===joiner[`${component_type}_id`])||null},getWhere:where=>{let indexConfig=options.indexConfig||{},keys=Object.keys(where);if(keys.length===1&&indexConfig.byCustomField&&internalStore.indexes.byCustomField){let field=keys[0],fieldMap=internalStore.indexes.byCustomField.get(field);if(fieldMap){let fieldValue=String(where[field]);return(fieldMap.get(fieldValue)||[]).find(e5=>e5.type===component_type)||null}}if("subcircuit_id"in where&&indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit){let subcircuitId=where.subcircuit_id;return(internalStore.indexes.bySubcircuit.get(subcircuitId)||[]).find(e5=>e5.type===component_type&&keys.every(key=>e5[key]===where[key]))||null}return indexConfig.byType&&internalStore.indexes.byType?(internalStore.indexes.byType.get(component_type)||[]).find(e5=>keys.every(key=>e5[key]===where[key]))||null:soup.find(e5=>e5.type===component_type&&keys.every(key=>e5[key]===where[key]))||null},list:where=>{let indexConfig=options.indexConfig||{},keys=where?Object.keys(where):[];if(keys.length===0&&indexConfig.byType&&internalStore.indexes.byType)return internalStore.indexes.byType.get(component_type)||[];if(keys.length===1&&keys[0]==="subcircuit_id"&&indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit){let subcircuitId=where.subcircuit_id;return(internalStore.indexes.bySubcircuit.get(subcircuitId)||[]).filter(e5=>e5.type===component_type)}let elementsToFilter;return indexConfig.byType&&internalStore.indexes.byType?elementsToFilter=internalStore.indexes.byType.get(component_type)||[]:elementsToFilter=soup.filter(e5=>e5.type===component_type),keys.length>0?elementsToFilter.filter(e5=>keys.every(key=>e5[key]===where[key])):elementsToFilter},insert:elm=>{var _a415;(_a415=internalStore.counts)[component_type]??(_a415[component_type]=-1),internalStore.counts[component_type]++;let index=internalStore.counts[component_type],newElm={type:component_type,[`${component_type}_id`]:`${component_type}_${index}`,...elm};options.validateInserts&&(dist_exports6[component_type]??any_soup_element2).parse(newElm),soup.push(newElm),internalStore.editCount++;let indexConfig=options.indexConfig||{};if(indexConfig.byId&&internalStore.indexes.byId){let idKey=createIdKey2(newElm);internalStore.indexes.byId.set(idKey,newElm)}if(indexConfig.byType&&internalStore.indexes.byType){let elementsOfType=internalStore.indexes.byType.get(component_type)||[];elementsOfType.push(newElm),internalStore.indexes.byType.set(component_type,elementsOfType)}if(indexConfig.byRelation&&internalStore.indexes.byRelation){let elementEntries=Object.entries(newElm);for(let[key,value]of elementEntries)if(key.endsWith("_id")&&key!==`${newElm.type}_id`&&typeof value=="string"){let relationTypeMap=internalStore.indexes.byRelation.get(key)||new Map,relatedElements=relationTypeMap.get(value)||[];relatedElements.push(newElm),relationTypeMap.set(value,relatedElements),internalStore.indexes.byRelation.set(key,relationTypeMap)}}if(indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit&&"subcircuit_id"in newElm){let subcircuitId=newElm.subcircuit_id;if(subcircuitId&&typeof subcircuitId=="string"){let subcircuitElements=internalStore.indexes.bySubcircuit.get(subcircuitId)||[];subcircuitElements.push(newElm),internalStore.indexes.bySubcircuit.set(subcircuitId,subcircuitElements)}}if(indexConfig.byCustomField&&internalStore.indexes.byCustomField){for(let field of indexConfig.byCustomField)if(field in newElm){let fieldValue=newElm[field];if(fieldValue!==void 0&&(typeof fieldValue=="string"||typeof fieldValue=="number")){let fieldValueStr=String(fieldValue),fieldMap=internalStore.indexes.byCustomField.get(field),elementsWithFieldValue=fieldMap.get(fieldValueStr)||[];elementsWithFieldValue.push(newElm),fieldMap.set(fieldValueStr,elementsWithFieldValue)}}}return newElm},delete:id2=>{let indexConfig=options.indexConfig||{},elm;if(indexConfig.byId&&internalStore.indexes.byId?elm=internalStore.indexes.byId.get(`${component_type}:${id2}`):indexConfig.byType&&internalStore.indexes.byType?elm=(internalStore.indexes.byType.get(component_type)||[]).find(e5=>e5[`${component_type}_id`]===id2):elm=soup.find(e5=>e5[`${component_type}_id`]===id2),!elm)return;let elmIndex=soup.indexOf(elm);if(elmIndex>=0&&(soup.splice(elmIndex,1),internalStore.editCount++),indexConfig.byId&&internalStore.indexes.byId){let idKey=createIdKey2(elm);internalStore.indexes.byId.delete(idKey)}if(indexConfig.byType&&internalStore.indexes.byType){let filteredElements=(internalStore.indexes.byType.get(component_type)||[]).filter(e5=>e5[`${component_type}_id`]!==id2);internalStore.indexes.byType.set(component_type,filteredElements)}if(indexConfig.byRelation&&internalStore.indexes.byRelation)for(let[relationKey,relationMap]of internalStore.indexes.byRelation.entries())for(let[relationValue,elements]of relationMap.entries()){let updatedElements=elements.filter(e5=>e5!==elm);updatedElements.length===0?relationMap.delete(relationValue):relationMap.set(relationValue,updatedElements)}if(indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit&&"subcircuit_id"in elm){let subcircuitId=elm.subcircuit_id;if(subcircuitId){let updatedElements=(internalStore.indexes.bySubcircuit.get(subcircuitId)||[]).filter(e5=>e5!==elm);updatedElements.length===0?internalStore.indexes.bySubcircuit.delete(subcircuitId):internalStore.indexes.bySubcircuit.set(subcircuitId,updatedElements)}}if(indexConfig.byCustomField&&internalStore.indexes.byCustomField)for(let fieldMap of internalStore.indexes.byCustomField.values())for(let[fieldValue,elements]of fieldMap.entries()){let updatedElements=elements.filter(e5=>e5!==elm);updatedElements.length===0?fieldMap.delete(fieldValue):fieldMap.set(fieldValue,updatedElements)}},update:(id2,newProps)=>{let indexConfig=options.indexConfig||{},elm;if(indexConfig.byId&&internalStore.indexes.byId?elm=internalStore.indexes.byId.get(`${component_type}:${id2}`):indexConfig.byType&&internalStore.indexes.byType?elm=(internalStore.indexes.byType.get(component_type)||[]).find(e5=>e5[`${component_type}_id`]===id2):elm=soup.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===id2),!elm)return null;if(indexConfig.byRelation&&internalStore.indexes.byRelation){let elementEntries=Object.entries(elm);for(let[key,value]of elementEntries)if(key.endsWith("_id")&&key!==`${elm.type}_id`&&typeof value=="string"&&key in newProps&&newProps[key]!==value){let relationTypeMap=internalStore.indexes.byRelation.get(key);if(relationTypeMap){let updatedElements=(relationTypeMap.get(value)||[]).filter(e5=>e5!==elm);updatedElements.length===0?relationTypeMap.delete(value):relationTypeMap.set(value,updatedElements)}}}if(indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit&&"subcircuit_id"in elm&&"subcircuit_id"in newProps){let oldSubcircuitId=elm.subcircuit_id,newSubcircuitId=newProps.subcircuit_id;if(oldSubcircuitId!==newSubcircuitId){let updatedElements=(internalStore.indexes.bySubcircuit.get(oldSubcircuitId)||[]).filter(e5=>e5!==elm);updatedElements.length===0?internalStore.indexes.bySubcircuit.delete(oldSubcircuitId):internalStore.indexes.bySubcircuit.set(oldSubcircuitId,updatedElements)}}if(indexConfig.byCustomField&&internalStore.indexes.byCustomField){for(let field of indexConfig.byCustomField)if(field in elm&&field in newProps&&elm[field]!==newProps[field]){let fieldMap=internalStore.indexes.byCustomField.get(field);if(fieldMap){let oldValue=String(elm[field]),updatedElements=(fieldMap.get(oldValue)||[]).filter(e5=>e5!==elm);updatedElements.length===0?fieldMap.delete(oldValue):fieldMap.set(oldValue,updatedElements)}}}if(Object.assign(elm,newProps),internalStore.editCount++,indexConfig.byRelation&&internalStore.indexes.byRelation){let elementEntries=Object.entries(elm);for(let[key,value]of elementEntries)if(key.endsWith("_id")&&key!==`${elm.type}_id`&&typeof value=="string"&&key in newProps){let relationTypeMap=internalStore.indexes.byRelation.get(key)||new Map,relatedElements=relationTypeMap.get(value)||[];relatedElements.includes(elm)||(relatedElements.push(elm),relationTypeMap.set(value,relatedElements),internalStore.indexes.byRelation.set(key,relationTypeMap))}}if(indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit&&"subcircuit_id"in elm&&"subcircuit_id"in newProps){let subcircuitId=elm.subcircuit_id;if(subcircuitId&&typeof subcircuitId=="string"){let subcircuitElements=internalStore.indexes.bySubcircuit.get(subcircuitId)||[];subcircuitElements.includes(elm)||(subcircuitElements.push(elm),internalStore.indexes.bySubcircuit.set(subcircuitId,subcircuitElements))}}if(indexConfig.byCustomField&&internalStore.indexes.byCustomField){for(let field of indexConfig.byCustomField)if(field in elm&&field in newProps){let fieldValue=elm[field];if(fieldValue!==void 0&&(typeof fieldValue=="string"||typeof fieldValue=="number")){let fieldValueStr=String(fieldValue),fieldMap=internalStore.indexes.byCustomField.get(field),elementsWithFieldValue=fieldMap.get(fieldValueStr)||[];elementsWithFieldValue.includes(elm)||(elementsWithFieldValue.push(elm),fieldMap.set(fieldValueStr,elementsWithFieldValue))}}}return elm},select:selector=>{if(component_type==="source_component")return soup.find(e5=>e5.type==="source_component"&&e5.name===selector.replace(/\./g,""))||null;if(component_type==="pcb_port"||component_type==="source_port"||component_type==="schematic_port"){let[component_name,port_selector]=selector.replace(/\./g,"").split(/[\s\>]+/),source_component=soup.find(e5=>e5.type==="source_component"&&e5.name===component_name);if(!source_component)return null;let source_port22=soup.find(e5=>e5.type==="source_port"&&e5.source_component_id===source_component.source_component_id&&(e5.name===port_selector||(e5.port_hints??[]).includes(port_selector)));if(!source_port22)return null;if(component_type==="source_port")return source_port22;if(component_type==="pcb_port")return soup.find(e5=>e5.type==="pcb_port"&&e5.source_port_id===source_port22.source_port_id)||null;if(component_type==="schematic_port")return soup.find(e5=>e5.type==="schematic_port"&&e5.source_port_id===source_port22.source_port_id)||null}return null}}}})};cjuIndexed2.unparsed=cjuIndexed2;var transformPCBElement2=(elm,matrix2)=>{let tsr=decomposeTSR3(matrix2),flipPadWidthHeight=Math.round(tsr.rotation.angle/(Math.PI/2))%2===1;if(elm.type==="pcb_plated_hole"||elm.type==="pcb_hole"||elm.type==="pcb_via"||elm.type==="pcb_smtpad"||elm.type==="pcb_port"){let{x:x4,y:y4}=applyToPoint4(matrix2,{x:Number(elm.x),y:Number(elm.y)});elm.x=x4,elm.y=y4,elm.type==="pcb_smtpad"&&elm.shape==="polygon"&&Array.isArray(elm.points)&&(elm.points=elm.points.map(point23=>{let tp3=applyToPoint4(matrix2,{x:point23.x,y:point23.y});return{x:tp3.x,y:tp3.y}}))}else if(elm.type==="pcb_keepout"||elm.type==="pcb_board")elm.center=applyToPoint4(matrix2,elm.center);else if(elm.type==="pcb_silkscreen_text"||elm.type==="pcb_fabrication_note_text"||elm.type==="pcb_note_text")elm.anchor_position=applyToPoint4(matrix2,elm.anchor_position);else if(elm.type==="pcb_silkscreen_circle"||elm.type==="pcb_silkscreen_rect"||elm.type==="pcb_note_rect"||elm.type==="pcb_courtyard_rect"||elm.type==="pcb_courtyard_circle")elm.center=applyToPoint4(matrix2,elm.center);else if(elm.type==="pcb_component")elm.center=applyToPoint4(matrix2,elm.center),elm.rotation=elm.rotation+tsr.rotation.angle/Math.PI*180,elm.rotation=elm.rotation%360,flipPadWidthHeight&&([elm.width,elm.height]=[elm.height,elm.width]);else if(elm.type==="pcb_courtyard_outline")elm.outline=elm.outline.map(p4=>{let tp3=applyToPoint4(matrix2,p4);return p4.x=tp3.x,p4.y=tp3.y,p4});else if(elm.type==="pcb_courtyard_polygon")elm.points=elm.points.map(p4=>{let tp3=applyToPoint4(matrix2,p4);return p4.x=tp3.x,p4.y=tp3.y,p4});else if(elm.type==="pcb_silkscreen_path"||elm.type==="pcb_trace"||elm.type==="pcb_fabrication_note_path"||elm.type==="pcb_note_path")elm.route=elm.route.map(rp3=>{let tp3=applyToPoint4(matrix2,rp3);return rp3.x=tp3.x,rp3.y=tp3.y,rp3});else if(elm.type==="pcb_silkscreen_line"||elm.type==="pcb_note_line"){let p12={x:elm.x1,y:elm.y1},p22={x:elm.x2,y:elm.y2},p1t=applyToPoint4(matrix2,p12),p2t=applyToPoint4(matrix2,p22);elm.x1=p1t.x,elm.y1=p1t.y,elm.x2=p2t.x,elm.y2=p2t.y}else if(elm.type==="cad_component"){let newPos=applyToPoint4(matrix2,{x:elm.position.x,y:elm.position.y});elm.position.x=newPos.x,elm.position.y=newPos.y}return elm},transformPCBElements2=(elms,matrix2)=>{let tsr=decomposeTSR3(matrix2),quarterTurns=Math.round(tsr.rotation.angle/(Math.PI/2)),flipPadWidthHeight=Math.abs(quarterTurns)%2===1,transformedElms=elms.map(elm=>transformPCBElement2(elm,matrix2));return flipPadWidthHeight&&(transformedElms=transformedElms.map(elm=>(elm.type==="pcb_smtpad"&&elm.shape==="rect"&&([elm.width,elm.height]=[elm.height,elm.width]),elm))),transformedElms};function stringHash3(str){let hash=0;if(str.length==0)return hash;for(var i3=0;i3<str.length;i3++){var char=str.charCodeAt(i3);hash=(hash<<5)-hash+char,hash=hash&hash}return Math.abs(hash)}var nice_color_palettes2=[["#69d2e7","#a7dbd8","#e0e4cc","#f38630","#fa6900"],["#fe4365","#fc9d9a","#f9cdad","#c8c8a9","#83af9b"],["#ecd078","#d95b43","#c02942","#542437","#53777a"],["#556270","#4ecdc4","#c7f464","#ff6b6b","#c44d58"],["#774f38","#e08e79","#f1d4af","#ece5ce","#c5e0dc"],["#e8ddcb","#cdb380","#036564","#033649","#031634"],["#490a3d","#bd1550","#e97f02","#f8ca00","#8a9b0f"],["#594f4f","#547980","#45ada8","#9de0ad","#e5fcc2"],["#00a0b0","#6a4a3c","#cc333f","#eb6841","#edc951"],["#e94e77","#d68189","#c6a49a","#c6e5d9","#f4ead5"],["#3fb8af","#7fc7af","#dad8a7","#ff9e9d","#ff3d7f"],["#d9ceb2","#948c75","#d5ded9","#7a6a53","#99b2b7"],["#ffffff","#cbe86b","#f2e9e1","#1c140d","#cbe86b"],["#efffcd","#dce9be","#555152","#2e2633","#99173c"],["#343838","#005f6b","#008c9e","#00b4cc","#00dffc"],["#413e4a","#73626e","#b38184","#f0b49e","#f7e4be"],["#ff4e50","#fc913a","#f9d423","#ede574","#e1f5c4"],["#99b898","#fecea8","#ff847c","#e84a5f","#2a363b"],["#655643","#80bca3","#f6f7bd","#e6ac27","#bf4d28"],["#00a8c6","#40c0cb","#f9f2e7","#aee239","#8fbe00"],["#351330","#424254","#64908a","#e8caa4","#cc2a41"],["#554236","#f77825","#d3ce3d","#f1efa5","#60b99a"],["#5d4157","#838689","#a8caba","#cad7b2","#ebe3aa"],["#8c2318","#5e8c6a","#88a65e","#bfb35a","#f2c45a"],["#fad089","#ff9c5b","#f5634a","#ed303c","#3b8183"],["#ff4242","#f4fad2","#d4ee5e","#e1edb9","#f0f2eb"],["#f8b195","#f67280","#c06c84","#6c5b7b","#355c7d"],["#d1e751","#ffffff","#000000","#4dbce9","#26ade4"],["#1b676b","#519548","#88c425","#bef202","#eafde6"],["#5e412f","#fcebb6","#78c0a8","#f07818","#f0a830"],["#bcbdac","#cfbe27","#f27435","#f02475","#3b2d38"],["#452632","#91204d","#e4844a","#e8bf56","#e2f7ce"],["#eee6ab","#c5bc8e","#696758","#45484b","#36393b"],["#f0d8a8","#3d1c00","#86b8b1","#f2d694","#fa2a00"],["#2a044a","#0b2e59","#0d6759","#7ab317","#a0c55f"],["#f04155","#ff823a","#f2f26f","#fff7bd","#95cfb7"],["#b9d7d9","#668284","#2a2829","#493736","#7b3b3b"],["#bbbb88","#ccc68d","#eedd99","#eec290","#eeaa88"],["#b3cc57","#ecf081","#ffbe40","#ef746f","#ab3e5b"],["#a3a948","#edb92e","#f85931","#ce1836","#009989"],["#300030","#480048","#601848","#c04848","#f07241"],["#67917a","#170409","#b8af03","#ccbf82","#e33258"],["#aab3ab","#c4cbb7","#ebefc9","#eee0b7","#e8caaf"],["#e8d5b7","#0e2430","#fc3a51","#f5b349","#e8d5b9"],["#ab526b","#bca297","#c5ceae","#f0e2a4","#f4ebc3"],["#607848","#789048","#c0d860","#f0f0d8","#604848"],["#b6d8c0","#c8d9bf","#dadabd","#ecdbbc","#fedcba"],["#a8e6ce","#dcedc2","#ffd3b5","#ffaaa6","#ff8c94"],["#3e4147","#fffedf","#dfba69","#5a2e2e","#2a2c31"],["#fc354c","#29221f","#13747d","#0abfbc","#fcf7c5"],["#cc0c39","#e6781e","#c8cf02","#f8fcc1","#1693a7"],["#1c2130","#028f76","#b3e099","#ffeaad","#d14334"],["#a7c5bd","#e5ddcb","#eb7b59","#cf4647","#524656"],["#dad6ca","#1bb0ce","#4f8699","#6a5e72","#563444"],["#5c323e","#a82743","#e15e32","#c0d23e","#e5f04c"],["#edebe6","#d6e1c7","#94c7b6","#403b33","#d3643b"],["#fdf1cc","#c6d6b8","#987f69","#e3ad40","#fcd036"],["#230f2b","#f21d41","#ebebbc","#bce3c5","#82b3ae"],["#b9d3b0","#81bda4","#b28774","#f88f79","#f6aa93"],["#3a111c","#574951","#83988e","#bcdea5","#e6f9bc"],["#5e3929","#cd8c52","#b7d1a3","#dee8be","#fcf7d3"],["#1c0113","#6b0103","#a30006","#c21a01","#f03c02"],["#000000","#9f111b","#b11623","#292c37","#cccccc"],["#382f32","#ffeaf2","#fcd9e5","#fbc5d8","#f1396d"],["#e3dfba","#c8d6bf","#93ccc6","#6cbdb5","#1a1f1e"],["#f6f6f6","#e8e8e8","#333333","#990100","#b90504"],["#1b325f","#9cc4e4","#e9f2f9","#3a89c9","#f26c4f"],["#a1dbb2","#fee5ad","#faca66","#f7a541","#f45d4c"],["#c1b398","#605951","#fbeec2","#61a6ab","#accec0"],["#5e9fa3","#dcd1b4","#fab87f","#f87e7b","#b05574"],["#951f2b","#f5f4d7","#e0dfb1","#a5a36c","#535233"],["#8dccad","#988864","#fea6a2","#f9d6ac","#ffe9af"],["#2d2d29","#215a6d","#3ca2a2","#92c7a3","#dfece6"],["#413d3d","#040004","#c8ff00","#fa023c","#4b000f"],["#eff3cd","#b2d5ba","#61ada0","#248f8d","#605063"],["#ffefd3","#fffee4","#d0ecea","#9fd6d2","#8b7a5e"],["#cfffdd","#b4dec1","#5c5863","#a85163","#ff1f4c"],["#9dc9ac","#fffec7","#f56218","#ff9d2e","#919167"],["#4e395d","#827085","#8ebe94","#ccfc8e","#dc5b3e"],["#a8a7a7","#cc527a","#e8175d","#474747","#363636"],["#f8edd1","#d88a8a","#474843","#9d9d93","#c5cfc6"],["#046d8b","#309292","#2fb8ac","#93a42a","#ecbe13"],["#f38a8a","#55443d","#a0cab5","#cde9ca","#f1edd0"],["#a70267","#f10c49","#fb6b41","#f6d86b","#339194"],["#ff003c","#ff8a00","#fabe28","#88c100","#00c176"],["#ffedbf","#f7803c","#f54828","#2e0d23","#f8e4c1"],["#4e4d4a","#353432","#94ba65","#2790b0","#2b4e72"],["#0ca5b0","#4e3f30","#fefeeb","#f8f4e4","#a5b3aa"],["#4d3b3b","#de6262","#ffb88c","#ffd0b3","#f5e0d3"],["#fffbb7","#a6f6af","#66b6ab","#5b7c8d","#4f2958"],["#edf6ee","#d1c089","#b3204d","#412e28","#151101"],["#9d7e79","#ccac95","#9a947c","#748b83","#5b756c"],["#fcfef5","#e9ffe1","#cdcfb7","#d6e6c3","#fafbe3"],["#9cddc8","#bfd8ad","#ddd9ab","#f7af63","#633d2e"],["#30261c","#403831","#36544f","#1f5f61","#0b8185"],["#aaff00","#ffaa00","#ff00aa","#aa00ff","#00aaff"],["#d1313d","#e5625c","#f9bf76","#8eb2c5","#615375"],["#ffe181","#eee9e5","#fad3b2","#ffba7f","#ff9c97"],["#73c8a9","#dee1b6","#e1b866","#bd5532","#373b44"],["#805841","#dcf7f3","#fffcdd","#ffd8d8","#f5a2a2"]],getDebugLayoutObject2=lo3=>{let{x:x4,y:y4,width,height}={...lo3,...lo3.size,...lo3.center,...lo3.position};if(lo3.x1!==void 0&&lo3.x2!==void 0&&lo3.y1!==void 0&&lo3.y2!==void 0&&(x4=(lo3.x1+lo3.x2)/2,y4=(lo3.y1+lo3.y2)/2,width=Math.abs(lo3.x1-lo3.x2),height=Math.abs(lo3.y1-lo3.y2)),lo3.points&&Array.isArray(lo3.points)&&lo3.points.length>0){let xCoords=lo3.points.map(point23=>point23.x),yCoords=lo3.points.map(point23=>point23.y),minX=Math.min(...xCoords),maxX=Math.max(...xCoords),minY=Math.min(...yCoords),maxY=Math.max(...yCoords);x4=(minX+maxX)/2,y4=(minY+maxY)/2,width=maxX-minX,height=maxY-minY}let title=lo3.text||lo3.name||lo3.source?.text||lo3.source?.name||"?",content=lo3;return x4===void 0||y4===void 0?null:(width===void 0&&"outer_diameter"in lo3&&(width=lo3.outer_diameter,height=lo3.outer_diameter),(width===void 0||height===void 0)&&(width=.1,height=.1),{x:x4,y:y4,width,height,title,content,bg_color:nice_color_palettes2[stringHash3(lo3.type||title)%nice_color_palettes2.length]?.[4]??"#f00"})},isTruthy2=value=>!!value,findBoundsAndCenter2=elements=>{let debugObjects=elements.filter(elm=>elm.type.startsWith("pcb_")||elm.type.startsWith("schematic_")).concat(elements.filter(elm=>elm.type==="pcb_trace"||elm.type==="schematic_trace").flatMap(elm=>elm.route)).map(elm=>getDebugLayoutObject2(elm)).filter(isTruthy2);if(debugObjects.length===0)return{center:{x:0,y:0},width:0,height:0};let minX=debugObjects[0].x-debugObjects[0].width/2,maxX=debugObjects[0].x+debugObjects[0].width/2,minY=debugObjects[0].y-debugObjects[0].height/2,maxY=debugObjects[0].y+debugObjects[0].height/2;for(let obj of debugObjects.slice(1))minX=Math.min(minX,obj.x-obj.width/2),maxX=Math.max(maxX,obj.x+obj.width/2),minY=Math.min(minY,obj.y-obj.height/2),maxY=Math.max(maxY,obj.y+obj.height/2);let width=maxX-minX,height=maxY-minY;return{center:{x:minX+width/2,y:minY+height/2},width,height}},unitToMm3={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},mmNumberFormatter2=new Intl.NumberFormat("en-US",{useGrouping:!1,notation:"standard",maximumFractionDigits:12}),mm5=n4=>{let unit=typeof n4=="number"?"mm":n4.replace(/^[^a-zA-Z]+/g,"").toLowerCase();unit||(unit="mm");let val=typeof n4=="number"?n4:Number.parseFloat(n4.split(unit)[0]);if(unit in unitToMm3)return val*unitToMm3[unit];throw new Error(`Unsupported unit: ${unit}`)},mil2mm2=mil=>typeof mil=="number"?mm5(`${mil}mil`):mil.match(/^\d+$/)?mm5(`${mil}mil`):mm5(mil);function generateArcFromSweep(startX,startY,endX,endY,radius,largeArcFlag,sweepFlag){let start={x:startX,y:startY},end={x:endX,y:endY},midX=(startX+endX)/2,midY=(startY+endY)/2,dx3=endX-startX,dy3=endY-startY,distance33=Math.sqrt(dx3*dx3+dy3*dy3);if(distance33===0||radius<distance33/2)return[start,end];let h6=Math.sqrt(radius*radius-distance33*distance33/4),angle=Math.atan2(dy3,dx3),centerX=midX+h6*Math.sin(angle)*(sweepFlag?-1:1),centerY=midY-h6*Math.cos(angle)*(sweepFlag?-1:1),startAngle=Math.atan2(startY-centerY,startX-centerX),endAngle=Math.atan2(endY-centerY,endX-centerX);sweepFlag&&endAngle>startAngle?endAngle-=2*Math.PI:!sweepFlag&&endAngle<startAngle&&(endAngle+=2*Math.PI),(!largeArcFlag&&Math.abs(endAngle-startAngle)>Math.PI||largeArcFlag&&Math.abs(endAngle-startAngle)<Math.PI)&&(endAngle>startAngle?endAngle-=2*Math.PI:endAngle+=2*Math.PI);let numPoints=Math.max(2,Math.ceil(Math.abs(endAngle-startAngle)*radius)),path=[];for(let i3=0;i3<=numPoints;i3++){let t52=i3/numPoints,angle2=startAngle+t52*(endAngle-startAngle),x4=centerX+radius*Math.cos(angle2),y4=centerY+radius*Math.sin(angle2);path.push({x:x4,y:y4})}return path}var mil10ToMm=value=>value*10*.0254,getBoundsCenter2=bounds=>({x:(bounds.minX+bounds.maxX)/2,y:(bounds.minY+bounds.maxY)/2}),getBoundsFromPoints2=points=>{if(points.length===0)return null;let minX=points[0].x,minY=points[0].y,maxX=points[0].x,maxY=points[0].y;for(let i3=1;i3<points.length;i3++){let point23=points[i3];point23.x<minX&&(minX=point23.x),point23.y<minY&&(minY=point23.y),point23.x>maxX&&(maxX=point23.x),point23.y>maxY&&(maxY=point23.y)}return{minX,minY,maxX,maxY}},getCadSvgNode=easyEdaJson=>{let svgNode=easyEdaJson.packageDetail.dataStr.shape.find(shape=>shape.type==="SVGNODE"&&shape.svgData.attrs?.uuid);return svgNode?.type==="SVGNODE"?svgNode:null},isSvgChildNodeWithAttrs=childNode=>typeof childNode=="object"&&childNode!==null,getXyBoundsFromModelBounds=bounds=>({minX:bounds.min.x,minY:bounds.min.y,maxX:bounds.max.x,maxY:bounds.max.y}),rotateScenePoint=(point23,rotationDeg)=>{switch(rotationDeg){case 0:return point23;case 90:return{x:point23.y,y:-point23.x};case 180:return{x:-point23.x,y:-point23.y};case 270:return{x:-point23.y,y:point23.x}}},getEasyEdaModelOriginOnBoardMm=({svgNode,footprintCenterMm})=>{let points=[];for(let childNode of svgNode.svgData.childNodes??[]){if(!isSvgChildNodeWithAttrs(childNode))continue;let rawPoints=childNode.attrs?.points;if(!rawPoints)continue;let values=String(rawPoints).trim().split(/\s+/).map(Number);for(let i3=0;i3+1<values.length;i3+=2){let x4=values[i3],y4=values[i3+1];Number.isFinite(x4)&&Number.isFinite(y4)&&points.push({x:mil10ToMm(x4),y:mil10ToMm(y4)})}}let modelOriginMm=null;if(points.length>0){let bounds=getBoundsFromPoints2(points);modelOriginMm=bounds?getBoundsCenter2(bounds):null}else{let[originX,originY]=String(svgNode.svgData.attrs?.c_origin??"0,0").split(",").map(value=>Number(value.trim()));Number.isFinite(originX)&&Number.isFinite(originY)&&(modelOriginMm={x:mil10ToMm(originX),y:mil10ToMm(originY)})}return modelOriginMm?{x:modelOriginMm.x-footprintCenterMm.x,y:footprintCenterMm.y-modelOriginMm.y}:null},snapZero=value=>Math.abs(value)<1e-6?0:value,normalizePoint=point23=>({x:snapZero(point23.x),y:snapZero(point23.y)}),getCadModelOffsetMmFromBounds=(easyEdaJson,bounds,{footprintBoundsCenterMm}={})=>{let svgNode=getCadSvgNode(easyEdaJson);if(!svgNode||!bounds)return null;let[,,rotationZRaw]=String(svgNode.svgData.attrs?.c_rotation??"0,0,0").split(",").map(value=>Number(value.trim())),rotationDeg=(rotationZRaw%360+360)%360;if(![0,90,180,270].includes(rotationDeg))return null;let modelCenter=getBoundsCenter2(getXyBoundsFromModelBounds(bounds)),footprintCenter=easyEdaJson.packageDetail.dataStr.head,footprintCenterMm=footprintBoundsCenterMm??{x:mil10ToMm(footprintCenter.x),y:mil10ToMm(footprintCenter.y)},targetOriginOnBoardMm=getEasyEdaModelOriginOnBoardMm({svgNode,footprintCenterMm});if(!targetOriginOnBoardMm)return null;let targetOriginInModelFrame=rotateScenePoint(targetOriginOnBoardMm,rotationDeg);return normalizePoint({x:modelCenter.x-targetOriginInModelFrame.x,y:modelCenter.y-targetOriginInModelFrame.y})},normalizePinLabels2=inputPinLabels=>{let uniqueInputPinLabels=inputPinLabels.map(labels=>[...new Set(labels)]),result=uniqueInputPinLabels.map(()=>[]),desiredNumbers=uniqueInputPinLabels.map(()=>null);for(let i3=0;i3<uniqueInputPinLabels.length;i3++)for(let label of uniqueInputPinLabels[i3])if(/^\d+$/.test(label)){desiredNumbers[i3]=Number.parseInt(label);break}let highestPinNumber=0,acceptedDesiredNumbers=new Set;for(let i3=0;i3<desiredNumbers.length;i3++){let desiredNumber=desiredNumbers[i3];if(desiredNumber===null||desiredNumber<1)continue;if(!acceptedDesiredNumbers.has(desiredNumber)){acceptedDesiredNumbers.add(desiredNumber),result[i3].push(`pin${desiredNumber}`),highestPinNumber=Math.max(highestPinNumber,desiredNumber);continue}let existingAltCount=0;for(let label of result[i3])label.startsWith(`pin${desiredNumber}_alt`)&&(existingAltCount+=1);result[i3].push(`pin${desiredNumber}_alt${existingAltCount+1}`)}for(let i3=0;i3<result.length;i3++)result[i3][0]?.includes("_alt")&&(highestPinNumber+=1,result[i3].unshift(`pin${highestPinNumber}`));for(let i3=0;i3<result.length;i3++)result[i3].length===0&&(highestPinNumber+=1,result[i3].push(`pin${highestPinNumber}`));let totalLabelCounts={};for(let inputLabels of uniqueInputPinLabels)for(let label of inputLabels)/^\d+$/.test(label)||(totalLabelCounts[label]=(totalLabelCounts[label]??0)+1);let incrementalLabelCounts={};for(let i3=0;i3<uniqueInputPinLabels.length;i3++)for(let label of uniqueInputPinLabels[i3])/^\d+$/.test(label)||(totalLabelCounts[label]===1?result[i3].push(label):(incrementalLabelCounts[label]=(incrementalLabelCounts[label]??0)+1,result[i3].push(`${label}${incrementalLabelCounts[label]}`)));return result},normalizeSymbolName=name=>{let trimmedName=name.trim();return trimmedName==="+"?"_POS":trimmedName==="-"?"_NEG":trimmedName},DEFAULT_PCB_THICKNESS_MM=1.6,EASYEDA_STEP_MODEL_URL="https://modules.easyeda.com/qAxj6KHrDKw4blvCG8QJPs7Y",EASYEDA_OBJ_MODEL_URL="https://modules.easyeda.com/3dmodel",TSCIRCUIT_MODEL_CDN_URL="https://modelcdn.tscircuit.com/easyeda_models",milx10=mil10=>typeof mil10=="number"||mil10.match(/^\d+$/)?mil2mm2(mil10)*10:mil2mm2(mil10),parseCadOffsetsFromSvgNode=svgNode=>{let attrs=svgNode?.svgData?.attrs??{},[cx3,cy3]=String(attrs.c_origin??"0,0").split(",").map(s3=>Number(s3.trim())),zStr=attrs.z??0,z_mm=typeof zStr=="string"&&/[a-z]/i.test(zStr)?mm5(zStr):mm5(`${Number(zStr)||0}mil`);return{position:{x:mil10ToMm(Number.isNaN(cx3)?0:cx3),y:mil10ToMm(Number.isNaN(cy3)?0:cy3),z:z_mm},rotation:(()=>{let[rx3,ry3,rz2]=(attrs.c_rotation??"0,0,0").split(",").map(Number);return{x:rx3||0,y:ry3||0,z:rz2||0}})()}},readModelHeightMm=raw=>{if(raw==null)return 3.5;let n4=Number(raw);if(!Number.isFinite(n4))return 3.5;let mmFromMil10=mil10ToMm(n4),mmFromMil=mm5(`${n4}mil`),upper=12,lower=.1,chosen=Math.max(mmFromMil10,mmFromMil);return(chosen>upper||chosen<lower)&&(chosen=3.5),chosen},handleSilkscreenPath=(track,index)=>pcb_silkscreen_path2.parse({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_path_${index+1}`,pcb_component_id:"pcb_component_1",layer:"top",route:track.points.map(point23=>({x:milx10(point23.x),y:milx10(point23.y)})),stroke_width:mil10ToMm(track.width)}),isCourtyardLayer=layer=>layer===13||layer===14||layer===15,handleSilkscreenArc=(arc2,index)=>{let arcPath=generateArcFromSweep(arc2.start.x,arc2.start.y,arc2.end.x,arc2.end.y,arc2.radiusX,arc2.largeArc,arc2.sweepDirection==="CW");return pcb_silkscreen_path2.parse({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_arc_${index+1}`,pcb_component_id:"pcb_component_1",layer:"top",route:arcPath.map(p4=>({x:milx10(p4.x),y:milx10(p4.y)})),stroke_width:mil10ToMm(arc2.width)})},handleHole=(hole,index)=>pcb_hole2.parse({type:"pcb_hole",x:milx10(hole.center.x),y:milx10(hole.center.y),hole_diameter:milx10(hole.radius)*2,hole_shape:"circle",pcb_hole_id:`pcb_hole_${index+1}`}),handleHoleCutout=(hole,index)=>pcb_cutout2.parse({type:"pcb_cutout",pcb_cutout_id:`pcb_cutout_from_hole_${index+1}`,shape:"circle",center:{x:milx10(hole.center.x),y:milx10(hole.center.y)},radius:milx10(hole.radius)}),handleVia=(via,index)=>pcb_via2.parse({type:"pcb_via",pcb_via_id:`pcb_via_${index+1}`,x:milx10(via.center.x),y:milx10(via.center.y),outer_diameter:milx10(via.outerDiameter),hole_diameter:milx10(via.holeDiameter),layers:["top","bottom"]}),handleCutout=(solidRegion,index)=>pcb_cutout2.parse({type:"pcb_cutout",pcb_cutout_id:`pcb_cutout_${index+1}`,shape:"polygon",points:solidRegion.points.map(p4=>({x:milx10(p4.x),y:milx10(p4.y)}))}),LEAD_SHAPE_LAYER=100,isPcbSolidRegionCutout=shape=>shape.fillStyle==="cutout"&&shape.layermask!==LEAD_SHAPE_LAYER,getCadPositionZMmFromMetadata=easyEdaJson=>{let svgNode=easyEdaJson.packageDetail.dataStr.shape.find(shape=>shape.type==="SVGNODE"&&shape.svgData.attrs?.uuid);if(!svgNode||svgNode.type!=="SVGNODE")return;let svgNodeZ=Number(svgNode.svgData.attrs?.z??0);if(!Number.isFinite(svgNodeZ))return;let bounds=easyEdaJson._objMetadata?.bounds;return bounds?(Math.abs(bounds.min.z)<1e-6?0:bounds.min.z)-mil10ToMm(svgNodeZ):void 0},convertEasyEdaJsonToCircuitJson=(easyEdaJson,{useModelCdn,shouldRecenter=!0,cadPositionXMm,cadPositionYMm,cadPositionZMm,cadModelBounds,showDesignator=!1}={})=>{let resolvedCadPositionZMm=cadPositionZMm??getCadPositionZMmFromMetadata(easyEdaJson),circuitElements=[],source_component=any_source_component2.parse({type:"source_component",source_component_id:"source_component_1",name:"U1",ftype:"simple_chip"}),pcb_component22=pcb_component2.parse({type:"pcb_component",pcb_component_id:"pcb_component_1",source_component_id:"source_component_1",name:"U1",ftype:"simple_chip",width:0,height:0,rotation:0,center:{x:0,y:0},layer:"top"});circuitElements.push(source_component,pcb_component22);let pads=easyEdaJson.packageDetail.dataStr.shape.filter(shape=>shape.type==="PAD"),pins=easyEdaJson.dataStr.shape.filter(shape=>shape.type==="PIN"),pinLabelSets=pads.map(pad2=>{let labels=[];pad2.number&&labels.push(pad2.number.toString());let pin=pins.find(p4=>p4.pinNumber===pad2.number);return pin&&labels.push(normalizeSymbolName(pin.label)),labels}),normalizedPinLabels=normalizePinLabels2(pinLabelSets);pads.forEach((pad2,index)=>{let portHints2=normalizedPinLabels[index],pinNumber=Number.parseInt(portHints2.find(hint=>hint.match(/pin\d+/)).replace("pin",""));if(circuitElements.push({type:"source_port",source_port_id:`source_port_${index+1}`,source_component_id:"source_component_1",name:`pin${pinNumber}`,pin_number:pinNumber,port_hints:portHints2.filter(hint=>hint!==`pin${pinNumber}`)}),pad2.holeRadius!==void 0&&mil2mm2(pad2.holeRadius)!==0){let commonPlatedHoleProps={type:"pcb_plated_hole",pcb_plated_hole_id:pad2.shape==="RECT"&&pad2.rotation!==void 0?`pcb_plated_hole_${index+1}_rot${pad2.rotation}`:`pcb_plated_hole_${index+1}`,x:mil2mm2(pad2.center.x),y:mil2mm2(pad2.center.y),layers:["top"],port_hints:[`pin${pinNumber}`],pcb_component_id:"pcb_component_1",pcb_port_id:`pcb_port_${index+1}`},additionalPlatedHoleProps;if(pad2.shape==="OVAL"){let largestOuterDimensionName=mil2mm2(pad2.width)>mil2mm2(pad2.height)?"width":"height",smallestOuterDimension=Math.min(mil2mm2(pad2.width),mil2mm2(pad2.height)),largestOuterDimension=Math.max(mil2mm2(pad2.width),mil2mm2(pad2.height)),distanceFromOuterPlatingToHole=smallestOuterDimension/2-mil2mm2(pad2.holeRadius),largestInnerDimension=largestOuterDimension-distanceFromOuterPlatingToHole*2,smallestInnerDimension=mil2mm2(pad2.holeRadius)*2;additionalPlatedHoleProps={shape:"pill",hole_width:largestOuterDimensionName==="width"?largestInnerDimension:smallestInnerDimension,hole_height:largestOuterDimensionName==="height"?largestInnerDimension:smallestInnerDimension,outer_width:mil2mm2(pad2.width),outer_height:mil2mm2(pad2.height),ccw_rotation:pad2.rotation||0}}else if(pad2.shape==="RECT"){let padWidth=mil2mm2(pad2.width),padHeight=mil2mm2(pad2.height),holeDiameter=mil2mm2(pad2.holeRadius)*2;if(Math.max(padWidth,padHeight)/Math.min(padWidth,padHeight)>1.5){let baseWidth=holeDiameter,pillHeight=baseWidth*2.6,holeWidth=padWidth>padHeight?pillHeight:baseWidth,holeHeight=padHeight>padWidth?pillHeight:baseWidth;additionalPlatedHoleProps={shape:"rotated_pill_hole_with_rect_pad",hole_shape:"rotated_pill",pad_shape:"rect",hole_width:holeWidth,hole_height:holeHeight,hole_ccw_rotation:pad2.rotation||0,rect_ccw_rotation:pad2.rotation||0,rect_pad_width:padWidth,rect_pad_height:padHeight}}else additionalPlatedHoleProps={shape:"circle",hole_diameter:holeDiameter,outer_diameter:Math.max(padWidth,padHeight),radius:holeDiameter/2}}else additionalPlatedHoleProps={shape:"circle",hole_diameter:mil2mm2(pad2.holeRadius)*2,outer_diameter:mil2mm2(pad2.width),radius:mil2mm2(pad2.holeRadius)};circuitElements.push(pcb_plated_hole2.parse({...commonPlatedHoleProps,...additionalPlatedHoleProps}))}else{let soupShape;if(pad2.shape==="RECT"||pad2.shape==="ELLIPSE"?soupShape="rect":pad2.shape==="OVAL"?soupShape="pill":pad2.shape==="POLYGON"&&(soupShape="polygon"),!soupShape)throw new Error(`unknown pad.shape: "${pad2.shape}"`);let rectSize={width:mil2mm2(pad2.width),height:mil2mm2(pad2.height)};(pad2.rotation===90||pad2.rotation===270)&&(rectSize.width=mil2mm2(pad2.height),rectSize.height=mil2mm2(pad2.width));let parsedPcbSmtpad=pcb_smtpad2.parse({type:"pcb_smtpad",pcb_smtpad_id:`pcb_smtpad_${index+1}`,shape:soupShape,...soupShape!=="polygon"&&{x:mil2mm2(pad2.center.x),y:mil2mm2(pad2.center.y)},...soupShape==="rect"?rectSize:soupShape==="pill"?{...rectSize,radius:Math.min(rectSize.width,rectSize.height)/2}:soupShape==="polygon"&&pad2.points?{points:pad2.points.map(p4=>({x:milx10(p4.x),y:milx10(p4.y)}))}:{radius:Math.min(mil2mm2(pad2.width),mil2mm2(pad2.height))/2},layer:"top",port_hints:[`pin${pinNumber}`],pcb_component_id:"pcb_component_1",pcb_port_id:`pcb_port_${index+1}`});circuitElements.push(parsedPcbSmtpad)}}),easyEdaJson.packageDetail.dataStr.shape.filter(shape=>shape.type==="HOLE").forEach((h6,index)=>{circuitElements.push(handleHole(h6,index)),circuitElements.push(handleHoleCutout(h6,index))}),easyEdaJson.packageDetail.dataStr.shape.filter(shape=>shape.type==="VIA").forEach((v4,index)=>{circuitElements.push(handleVia(v4,index))}),easyEdaJson.packageDetail.dataStr.shape.filter(shape=>shape.type==="SOLIDREGION"&&isPcbSolidRegionCutout(shape)).forEach((sr3,index)=>{circuitElements.push(handleCutout(sr3,index))});let hasFoundDesignator=!1;if(easyEdaJson.packageDetail.dataStr.shape.forEach((shape,index)=>{if(shape.type==="TRACK")isCourtyardLayer(shape.layer)||circuitElements.push(handleSilkscreenPath(shape,index));else if(shape.type==="ARC")isCourtyardLayer(shape.layer)||circuitElements.push(handleSilkscreenArc(shape,index));else if(shape.type==="TEXT"){if(isCourtyardLayer(shape.layer))return;let text=shape.text,designatorPrefix=easyEdaJson.dataStr.head.c_para.pre||"U",normalizedPrefix=designatorPrefix.replace(/\?/g,""),trimmedText=text.trim();if(trimmedText===designatorPrefix||trimmedText===`${normalizedPrefix}?`||trimmedText===normalizedPrefix){if(!showDesignator)return;text="{NAME}",hasFoundDesignator=!0}circuitElements.push(pcb_silkscreen_text2.parse({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pcb_silkscreen_text_${index+1}`,pcb_component_id:"pcb_component_1",text,anchor_position:{x:mil2mm2(shape.x),y:mil2mm2(shape.y)},anchor_alignment:{L:"bottom_left",C:"center",R:"bottom_right"}[shape.textAnchor??"L"],font_size:shape.size_mm||1,layer:"top"}))}}),!hasFoundDesignator&&showDesignator){let bbox=easyEdaJson.packageDetail.dataStr.BBox;circuitElements.push(pcb_silkscreen_text2.parse({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"pcb_silkscreen_text_designator_fallback",pcb_component_id:"pcb_component_1",text:"{NAME}",anchor_position:{x:milx10(bbox.x+bbox.width/2),y:milx10(bbox.y)-1},anchor_alignment:"center",font_size:1,layer:"top"}))}let pcbElements=circuitElements.filter(e5=>e5.type==="pcb_smtpad"||e5.type==="pcb_plated_hole"||e5.type==="pcb_hole"||e5.type==="pcb_via"||e5.type==="pcb_courtyard_outline"||e5.type==="pcb_silkscreen_path"||e5.type==="pcb_silkscreen_text");if(pcbElements.length>0){let bounds=findBoundsAndCenter2(pcbElements);pcb_component22.width=bounds.width,pcb_component22.height=bounds.height}let svgNode=easyEdaJson.packageDetail.dataStr.shape.find(a3=>!!(a3.type==="SVGNODE"&&a3.svgData.attrs?.uuid)),modelUuid=svgNode?.svgData?.attrs?.uuid,objFileUrl=modelUuid?useModelCdn?`${TSCIRCUIT_MODEL_CDN_URL}/assets/${easyEdaJson.lcsc.number}.obj?uuid=${modelUuid}`:`${EASYEDA_OBJ_MODEL_URL}/${modelUuid}`:void 0,stepFileUrl=modelUuid?useModelCdn?`${TSCIRCUIT_MODEL_CDN_URL}/assets/${easyEdaJson.lcsc.number}.step?uuid=${modelUuid}`:`${EASYEDA_STEP_MODEL_URL}/${modelUuid}`:void 0;if(objFileUrl!==void 0||stepFileUrl!==void 0){let{position:position22,rotation:rotation22}=parseCadOffsetsFromSvgNode(svgNode);circuitElements.push(cad_component2.parse({type:"cad_component",cad_component_id:"cad_component_1",source_component_id:"source_component_1",pcb_component_id:"pcb_component_1",anchor_alignment:"center_of_component_on_board_surface",model_origin_alignment:"center_of_component_on_board_surface",model_origin_position:{x:cadPositionXMm??0,y:cadPositionYMm??0,z:resolvedCadPositionZMm??position22.z},position:{x:0,y:0,z:0},rotation:rotation22,model_obj_url:objFileUrl,model_step_url:stepFileUrl}))}if(!circuitElements.some(e5=>e5.type==="pcb_courtyard_outline")){let bbox=easyEdaJson.packageDetail.dataStr.BBox;if(bbox){let x12=milx10(bbox.x)-.25,y12=milx10(bbox.y)-.25,x22=milx10(bbox.x+bbox.width)+.25,y22=milx10(bbox.y+bbox.height)+.25;circuitElements.push(pcb_courtyard_outline2.parse({type:"pcb_courtyard_outline",pcb_courtyard_outline_id:`pcb_courtyard_outline_${easyEdaJson.lcsc.number}_1`,pcb_component_id:"pcb_component_1",layer:"top",outline:[{x:x12,y:y12},{x:x22,y:y12},{x:x22,y:y22},{x:x12,y:y22},{x:x12,y:y12}],stroke_width:.05}))}}if(shouldRecenter){let elementsForBounds=circuitElements.filter(e5=>e5.type!=="pcb_component"&&e5.type!=="cad_component"),bounds=findBoundsAndCenter2(elementsForBounds);if(Number.isFinite(bounds.center.x)&&Number.isFinite(bounds.center.y)){let matrix2=compose4(translate4(-bounds.center.x,bounds.center.y),scale4(1,-1)),elementsForTransform=circuitElements.filter(e5=>!(e5.type==="pcb_smtpad"&&e5.shape==="polygon")&&e5.type!=="cad_component");transformPCBElements2(elementsForTransform,matrix2);for(let e5 of circuitElements)if(e5.type==="pcb_cutout"){if(e5.shape==="polygon")e5.points=e5.points.map(p4=>applyToPoint4(matrix2,p4));else if(e5.shape==="circle"||e5.shape==="rect")e5.center=applyToPoint4(matrix2,e5.center);else if("route"in e5){let cutoutPath=e5;cutoutPath.route=cutoutPath.route.map(p4=>applyToPoint4(matrix2,p4))}}else e5.type==="pcb_smtpad"&&e5.shape==="polygon"&&(e5.points=e5.points.map(p4=>applyToPoint4(matrix2,p4)));let cad=circuitElements.find(e5=>e5.type==="cad_component");if(cad){cad.rotation||(cad.rotation={x:0,y:0,z:0}),cad.model_origin_position||(cad.model_origin_position={x:0,y:0,z:0});let resolvedCadModelBounds=cadModelBounds??easyEdaJson._objMetadata?.bounds,recenteredCadOffset=resolvedCadModelBounds&&getCadModelOffsetMmFromBounds(easyEdaJson,resolvedCadModelBounds,{footprintBoundsCenterMm:bounds.center});recenteredCadOffset&&(cad.model_origin_position.x=recenteredCadOffset.x,cad.model_origin_position.y=recenteredCadOffset.y);let side=pcb_component22.layer??"top",t52=DEFAULT_PCB_THICKNESS_MM/2,attrs=svgNode?.svgData?.attrs??{},modelHeight=readModelHeightMm(attrs.c_height);cad.size||(cad.size={x:pcb_component22.width,y:pcb_component22.height,z:modelHeight});let ROTATE_X_FOR_YUP=90,originalZRotation=(cad.rotation.z??0)%360;Math.abs(originalZRotation-0)<1||Math.abs(originalZRotation-360)<1||Math.abs(originalZRotation-180)<1||Math.abs(originalZRotation-90)<1?cad.rotation.x=((cad.rotation.x??0)+0+360)%360:Math.abs(originalZRotation-270)<1?(cad.rotation.x=((cad.rotation.x??0)+0+360)%360,cad.rotation.y=((cad.rotation.y??0)+0+360)%360):(console.warn(`[3D] Unusual rotation angle: ${originalZRotation}\xB0 for component ${easyEdaJson.lcsc.number}`),cad.rotation.x=((cad.rotation.x??0)+ROTATE_X_FOR_YUP+360)%360),side!=="top"&&(cad.rotation.x=((cad.rotation.x??0)+180)%360);let USE_Z_OFFSET_FOR_180=Math.abs(originalZRotation-180)<1,zOffRaw=cad.model_origin_position.z??cad.position.z??0,zOff=USE_Z_OFFSET_FOR_180?-zOffRaw:0,rx3=(cad.rotation.x%360+360)%360,thicknessAlongWorldZ,is180RotatedYUp=(Math.abs(originalZRotation-180)<1||Math.abs(originalZRotation-0)<1||Math.abs(originalZRotation-360)<1)&&Math.abs(rx3)<1;if(is180RotatedYUp||rx3%180===90?thicknessAlongWorldZ=cad.size.y:thicknessAlongWorldZ=cad.size.z,Number.isFinite(resolvedCadPositionZMm))cad.model_origin_position.z=side==="top"?resolvedCadPositionZMm:-resolvedCadPositionZMm;else{let centerZ;is180RotatedYUp?centerZ=side==="top"?t52-thicknessAlongWorldZ/2:-t52+thicknessAlongWorldZ/2:centerZ=side==="top"?t52+zOff+thicknessAlongWorldZ/2:-t52-zOff-thicknessAlongWorldZ/2,cad.model_origin_position.z=centerZ}}}pcb_component22.center={x:0,y:0}}return circuitElements},safeNumber=(defaultValue=0)=>external_exports2.union([external_exports2.number(),external_exports2.string()]).transform(val=>{let num=Number(val);return isNaN(num)?defaultValue:num}).default(defaultValue),tenthmil=external_exports2.union([external_exports2.number(),external_exports2.string()]).optional().transform(n4=>typeof n4=="string"&&n4.endsWith("mil")?n4:`${Number.parseFloat(n4)*10}mil`).pipe(external_exports2.string()),PointSchema=external_exports2.any().transform(p4=>{if(Array.isArray(p4)){let[x4,y4]=p4;return{x:x4,y:y4}}if(typeof p4=="object")return p4;throw new Error(`Invalid point: ${p4}`)}).pipe(external_exports2.object({x:external_exports2.number(),y:external_exports2.number()})),BaseShapeSchema=external_exports2.object({type:external_exports2.string(),id:external_exports2.string().optional(),layer:external_exports2.coerce.number().optional()}),TrackSchema=BaseShapeSchema.extend({type:external_exports2.literal("TRACK"),width:external_exports2.coerce.number(),points:external_exports2.array(PointSchema)}),PadSchema=BaseShapeSchema.extend({type:external_exports2.literal("PAD"),shape:external_exports2.enum(["RECT","ELLIPSE","OVAL","POLYGON"]),center:external_exports2.object({x:tenthmil,y:tenthmil}),width:tenthmil,height:tenthmil,layermask:external_exports2.number(),net:external_exports2.union([external_exports2.string(),external_exports2.number()]).optional(),number:external_exports2.union([external_exports2.string(),external_exports2.number()]),holeRadius:tenthmil,points:external_exports2.array(PointSchema).optional(),rotation:safeNumber(0),plated:external_exports2.boolean()}),ArcSchema=BaseShapeSchema.extend({type:external_exports2.literal("ARC"),width:external_exports2.number(),start:PointSchema,end:PointSchema,radiusX:external_exports2.number(),radiusY:external_exports2.number(),largeArc:external_exports2.boolean(),sweepDirection:external_exports2.enum(["CW","CCW"])}),CircleSchema=BaseShapeSchema.extend({type:external_exports2.literal("CIRCLE"),center:PointSchema,radius:external_exports2.number(),width:external_exports2.number()}),SolidRegionSchema=BaseShapeSchema.extend({type:external_exports2.literal("SOLIDREGION"),layermask:external_exports2.number(),points:external_exports2.array(PointSchema),fillStyle:external_exports2.string()}),SVGNodeSchema=BaseShapeSchema.extend({type:external_exports2.literal("SVGNODE"),svgData:external_exports2.object({gId:external_exports2.string(),nodeName:external_exports2.string(),nodeType:external_exports2.number(),layerid:external_exports2.string(),attrs:external_exports2.record(external_exports2.string(),external_exports2.string()),childNodes:external_exports2.array(external_exports2.unknown())})}),HoleSchema=BaseShapeSchema.extend({type:external_exports2.literal("HOLE"),center:PointSchema,radius:external_exports2.number()}),ViaSchema=BaseShapeSchema.extend({type:external_exports2.literal("VIA"),center:PointSchema,outerDiameter:external_exports2.number(),holeDiameter:external_exports2.number()}),RectSchema=BaseShapeSchema.extend({type:external_exports2.literal("RECT"),x:tenthmil,y:tenthmil,width:tenthmil,height:tenthmil,lineWidth:external_exports2.number(),fillStyle:external_exports2.string(),rotation:external_exports2.number().optional()}),TextSchema=BaseShapeSchema.extend({type:external_exports2.literal("TEXT"),text:external_exports2.string(),x:tenthmil,y:tenthmil,size_mm:external_exports2.number(),rotation:external_exports2.number().optional(),layer:external_exports2.number().optional(),textAnchor:external_exports2.enum(["L","C","R",""]).optional().transform(val=>val===""?void 0:val),font:external_exports2.string().optional()}),PackageDetailShapeSchema=external_exports2.discriminatedUnion("type",[TrackSchema,PadSchema,ArcSchema,CircleSchema,SolidRegionSchema,SVGNodeSchema,HoleSchema,ViaSchema,RectSchema,TextSchema]),pairs3=arr=>{let pairs22=[];for(let i3=0;i3<arr.length;i3+=2)pairs22.push([arr[i3],arr[i3+1]]);return pairs22},parsePoints=pointsStr=>pairs3(pointsStr.trim().split(" ").map(n4=>Number(n4))),ShapeItemSchema=external_exports2.object({type:external_exports2.string(),data:external_exports2.string()}).transform(shape=>{switch(shape.type){case"TRACK":{let[width,layer,_4,pointsStr,id2,_n3]=shape.data.split("~"),points=parsePoints(pointsStr);return TrackSchema.parse({type:"TRACK",width,layer,points,id:id2})}case"PAD":{let[padShape,...params]=shape.data.split("~"),[centerX,centerY,width,height,layermask,net,number,holeRadius,...rest]=params.map(p4=>Number.isNaN(Number(p4))?p4:Number(p4)),center2={x:centerX,y:centerY},points;(padShape==="RECT"||padShape==="POLYGON")&&(points=parsePoints(rest[0]));let r5=Number(rest[1]),rotation22=Number.isNaN(r5)?void 0:r5,padInputParams={type:"PAD",shape:padShape,center:center2,width,height,layermask,net,number,holeRadius,points,rotation:rotation22,plated:rest.includes("Y")};return PadSchema.parse(padInputParams)}case"ARC":{let[width,layer,,arcData]=shape.data.split("~"),match2=arcData.match(/M\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)\s*A\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)/);if(!match2)throw new Error(`Invalid arc data: ${arcData}`);let[,startX,startY,radiusX,radiusY,xAxisRotation,largeArcFlag,sweepFlag,endX,endY]=match2,start=[Number(startX),Number(startY)],end=[Number(endX),Number(endY)];return ArcSchema.parse({type:"ARC",width:Number(width),layer:Number(layer),start,end,radiusX:Number(radiusX),radiusY:Number(radiusY),largeArc:largeArcFlag==="1",sweepDirection:sweepFlag==="1"?"CW":"CCW"})}case"CIRCLE":{let[centerX,centerY,radius,width,layer,id2]=shape.data.split("~"),center2=[Number(centerX),Number(centerY)];return CircleSchema.parse({type:"CIRCLE",center:center2,radius:Number(radius),width:Number(width),layer:Number(layer),id:id2})}case"HOLE":{let[centerX,centerY,radius,id2]=shape.data.split("~"),center2=[Number(centerX),Number(centerY)];return HoleSchema.parse({type:"HOLE",center:center2,radius:Number(radius),id:id2})}case"VIA":{let[x4,y4,outerDiameter,,holeDiameter,id2]=shape.data.split("~"),center2=[Number(x4),Number(y4)];return ViaSchema.parse({type:"VIA",center:center2,outerDiameter:Number(outerDiameter),holeDiameter:Number(holeDiameter),id:id2})}case"SOLIDREGION":{let[layermask,,pathData,fillStyle,id2]=shape.data.split("~"),points=pathData.match(/[ML] ?(-?[\d.]+)[ ,](-?[\d.]+)/g)?.map(point23=>{let[,x4,y4]=point23.match(/[ML]? ?(-?[\d.]+)[ ,](-?[\d.]+)/)||[];return[Number(x4),Number(y4)]})||[];return SolidRegionSchema.parse({type:"SOLIDREGION",layermask:Number(layermask),points,fillStyle,id:id2})}case"SVGNODE":{let svgData=JSON.parse(shape.data);return SVGNodeSchema.parse({type:"SVGNODE",svgData})}case"RECT":{let[x4,y4,width,height,lineWidth,id2,rotation22,layer,fillStyle]=shape.data.split("~"),r5=rotation22?Number(rotation22):void 0;return RectSchema.parse({type:"RECT",x:x4,y:y4,width,height,lineWidth:Number(lineWidth),id:id2,rotation:Number.isNaN(r5)?void 0:r5,layer:layer?Number(layer):void 0,fillStyle:fillStyle||void 0})}case"TEXT":{let[textAnchor,x4,y4,size22,layer,id2,rotation22,,font,text]=shape.data.split("~"),r5=rotation22?Number(rotation22):void 0;return TextSchema.parse({type:"TEXT",text,x:x4,y:y4,size_mm:Number(size22)*2.54,layer:layer?Number(layer):void 0,id:id2,rotation:Number.isNaN(r5)?void 0:r5,textAnchor,font:font||void 0})}default:throw new Error(`Unknown shape type: ${shape.type}`)}}).pipe(PackageDetailShapeSchema),ShapesArraySchema=external_exports2.array(ShapeItemSchema),PointSchema2=external_exports2.object({x:external_exports2.number(),y:external_exports2.number()}),RectangleShapeOutputSchema=external_exports2.object({type:external_exports2.literal("RECTANGLE"),position:PointSchema2,width:external_exports2.number(),height:external_exports2.number(),color:external_exports2.string(),lineWidth:external_exports2.number(),id:external_exports2.string()}),parseRectangle=str=>{let[,x4,y4,,,width,height,color,lineWidth,,,id2]=str.split("~");return{type:"RECTANGLE",position:{x:Number(x4),y:Number(y4)},width:Number(width),height:Number(height),color,lineWidth:Number(lineWidth),id:id2}},RectangleShapeSchema=external_exports2.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema),EllipseShapeOutputSchema=external_exports2.object({type:external_exports2.literal("ELLIPSE"),center:PointSchema2,radiusX:external_exports2.number(),radiusY:external_exports2.number(),color:external_exports2.string(),lineWidth:external_exports2.number(),id:external_exports2.string()}),parseEllipse=str=>{let[,x4,y4,radiusX,radiusY,color,lineWidth,,,id2]=str.split("~");return{type:"ELLIPSE",center:{x:Number(x4),y:Number(y4)},radiusX:Number(radiusX),radiusY:Number(radiusY),color,lineWidth:Number(lineWidth),id:id2}},EllipseShapeSchema=external_exports2.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema),ArcShapeOutputSchema=external_exports2.object({type:external_exports2.literal("ARC"),start:PointSchema2,end:PointSchema2,radius:external_exports2.number(),sweepFlag:external_exports2.boolean(),color:external_exports2.string(),lineWidth:external_exports2.number(),id:external_exports2.string()}),parseArc=str=>{let[,pathData,color,lineWidth,,,id2]=str.split("~"),parts=pathData.split(" "),x12=Number(parts[1])||0,y12=Number(parts[2])||0,radius=Number(parts[4])||0,sweepFlag=parts[7]==="1",x22=Number(parts[8])||0,y22=Number(parts[9])||0,parsedLineWidth=Number(lineWidth),finalLineWidth=Number.isNaN(parsedLineWidth)?1:parsedLineWidth;return{type:"ARC",start:{x:x12,y:y12},end:{x:x22,y:y22},radius,sweepFlag,color:color||"#880000",lineWidth:finalLineWidth,id:id2||"gge1"}},ArcShapeSchema=external_exports2.string().startsWith("A~").transform(parseArc).pipe(ArcShapeOutputSchema),PinShapeOutputSchema=external_exports2.object({type:external_exports2.literal("PIN"),visibility:external_exports2.enum(["show","hide","none"]),pinNumber:external_exports2.union([external_exports2.string(),external_exports2.number()]),x:external_exports2.number(),y:external_exports2.number(),rotation:external_exports2.number(),id:external_exports2.string(),label:external_exports2.string(),labelColor:external_exports2.string(),path:external_exports2.string(),arrow:external_exports2.string()}),parsePin=pinString=>{let parts=pinString.split("~"),[,visibility,,pinNumber,x4,y4,rotation22,id2]=parts,nameMatch=pinString.match(/~([\w+#-]+)~(start|end)~/),label=nameMatch?nameMatch[1]:"";label.endsWith("+")&&(label=label.slice(0,-1)+"_POS"),label.endsWith("-")&&(label=label.slice(0,-1)+"_NEG"),label.endsWith("#")&&(label=label.slice(0,-1)),/^\+\d+(?:\.\d+)?V$/i.test(label)&&(label=`V${label.slice(1,-1)}`);let colorMatch=pinString.match(/#[0-9A-F]{6}/),labelColor=colorMatch?colorMatch[0]:"",pathMatch=pinString.match(/\^\^([^~]+)/),path=pathMatch?pathMatch[1]:"",arrowMatch=pinString.match(/\^\^0~(.+)$/),arrow=arrowMatch?arrowMatch[1]:"",r5=Number.parseFloat(rotation22);return{type:"PIN",visibility,id:id2,pinNumber:Number.isNaN(Number(pinNumber))?pinNumber:Number(pinNumber),x:Number.parseFloat(x4),y:Number.parseFloat(y4),rotation:Number.isNaN(r5)?0:r5,label,labelColor,path,arrow}},PinShapeSchema=external_exports2.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema),PolylineShapeOutputSchema=external_exports2.object({type:external_exports2.literal("POLYLINE"),points:external_exports2.array(PointSchema2),color:external_exports2.string(),lineWidth:external_exports2.number(),id:external_exports2.string()}),parsePoints2=pointsStr=>pointsStr.split(" ").reduce((acc,value,index)=>(index%2===0?acc.push({x:Number(value),y:0}):acc[acc.length-1].y=Number(value),acc),[]),parsePolyline=str=>{let[,...rest]=str.split("~"),[pointsStr,color,lineWidth,,,id2]=rest;return{type:"POLYLINE",points:parsePoints2(pointsStr),color,lineWidth:Number(lineWidth),id:id2}},PolylineShapeSchema=external_exports2.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema),PolygonShapeOutputSchema=external_exports2.object({type:external_exports2.literal("POLYGON"),points:external_exports2.array(PointSchema2),fillColor:external_exports2.string(),lineWidth:external_exports2.number(),lineColor:external_exports2.string(),id:external_exports2.string()}),parsePolygon2=str=>{let[,...rest]=str.split("~"),[pointsStr,fillColor,lineWidth,lineColor,,id2]=rest;return{type:"POLYGON",points:parsePoints2(pointsStr),fillColor,lineWidth:Number(lineWidth),lineColor,id:id2}},PolygonShapeSchema=external_exports2.string().startsWith("PG~").transform(parsePolygon2).pipe(PolygonShapeOutputSchema),PathShapeOutputSchema=external_exports2.object({type:external_exports2.literal("PATH"),pathData:external_exports2.string(),fillColor:external_exports2.string(),strokeWidth:external_exports2.number(),strokeColor:external_exports2.string(),id:external_exports2.string()}),parsePath=str=>{let[,pathData,fillColor,strokeWidth,strokeColor,,id2]=str.split("~");return{type:"PATH",pathData,fillColor,strokeWidth:mil10ToMm(Number(strokeWidth)),strokeColor,id:id2}},PathShapeSchema=external_exports2.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema),optionalEasyEdaTextField=fieldSchema=>external_exports2.preprocess(textField=>{if(!(textField==null||textField===""||textField==="undefined"))return textField},fieldSchema),TextShapeOutputSchema=external_exports2.object({type:external_exports2.literal("TEXT"),alignment:external_exports2.enum(["L","C","R"]),x:external_exports2.number(),y:external_exports2.number(),rotation:external_exports2.number(),fontColor:external_exports2.string(),backgroundColor:optionalEasyEdaTextField(external_exports2.string().optional()),fontSize:external_exports2.string(),fontWeight:optionalEasyEdaTextField(external_exports2.string().optional().default("normal")),fontStyle:optionalEasyEdaTextField(external_exports2.enum(["normal","italic"]).optional().default("normal")),fontDecoration:optionalEasyEdaTextField(external_exports2.string().optional().default("")),content:external_exports2.string(),textType:external_exports2.string(),visibility:external_exports2.enum(["0","1"]),mirror:external_exports2.string(),id:external_exports2.string()}),parseText=str=>{let[,alignment,x4,y4,rotation22,fontColor,backgroundColor,fontSize,fontWeight,fontStyle,fontDecoration,content,textType,visibility,mirror,id2]=str.split("~");return{type:"TEXT",alignment,x:Number(x4),y:Number(y4),rotation:Number(rotation22),fontColor,backgroundColor,fontSize,fontWeight,fontStyle,fontDecoration,content,textType,visibility,mirror,id:id2}},TextShapeSchema=external_exports2.string().startsWith("T~").transform(parseText).pipe(TextShapeOutputSchema),SingleLetterShapeSchema=external_exports2.string().transform(x4=>{if(x4.startsWith("R~"))return RectangleShapeSchema.parse(x4);if(x4.startsWith("E~"))return EllipseShapeSchema.parse(x4);if(x4.startsWith("P~"))return PinShapeSchema.parse(x4);if(x4.startsWith("PL~"))return PolylineShapeSchema.parse(x4);if(x4.startsWith("PG~"))return PolygonShapeSchema.parse(x4);if(x4.startsWith("PT~"))return PathShapeSchema.parse(x4);if(x4.startsWith("T~"))return TextShapeSchema.parse(x4);if(x4.startsWith("A~"))return ArcShapeSchema.parse(x4);throw new Error(`Invalid shape type: ${x4}`)}).pipe(external_exports2.union([RectangleShapeOutputSchema,EllipseShapeOutputSchema,PinShapeOutputSchema,PolylineShapeOutputSchema,PolygonShapeOutputSchema,PathShapeOutputSchema,TextShapeOutputSchema,ArcShapeOutputSchema])),maybeNumber=external_exports2.any().transform(k4=>k4==="nan"||Number.isNaN(k4)?null:k4).pipe(external_exports2.number().nullable().optional()),SzlcscSchema=external_exports2.object({id:external_exports2.number(),number:external_exports2.string(),step:external_exports2.number().optional(),min:external_exports2.number().optional(),price:external_exports2.number().optional(),stock:external_exports2.number().optional(),url:external_exports2.string().url().optional(),image:external_exports2.string().optional().optional()}),LcscSchema=external_exports2.object({id:external_exports2.number(),number:external_exports2.string(),step:external_exports2.number().optional(),min:external_exports2.number().optional(),price:external_exports2.number().optional(),stock:external_exports2.number().optional(),url:external_exports2.string().url().optional()}),OwnerSchema=external_exports2.object({uuid:external_exports2.string(),username:external_exports2.string(),nickname:external_exports2.string(),avatar:external_exports2.string()}),HeadSchema=external_exports2.object({docType:external_exports2.preprocess(val=>val==null?val:String(val),external_exports2.string()),editorVersion:external_exports2.string(),c_para:external_exports2.record(external_exports2.string(),external_exports2.string().nullable()),x:external_exports2.number(),y:external_exports2.number(),puuid:external_exports2.string().optional(),uuid:external_exports2.string(),utime:external_exports2.preprocess(val=>val===""?0:typeof val=="string"?Number(val):val,external_exports2.number()),importFlag:external_exports2.number().optional(),c_spiceCmd:external_exports2.any().optional(),hasIdFlag:external_exports2.boolean()}),BBoxSchema=external_exports2.object({x:external_exports2.number(),y:external_exports2.number(),width:external_exports2.number(),height:external_exports2.number()}),LayerItemSchema=external_exports2.object({name:external_exports2.string(),color:external_exports2.string(),visible:external_exports2.boolean(),active:external_exports2.boolean(),config:external_exports2.boolean(),transparency:external_exports2.boolean()}),ObjectItemSchema=external_exports2.object({name:external_exports2.string(),visible:external_exports2.boolean(),locked:external_exports2.boolean()}),DataStrSchema=external_exports2.object({head:HeadSchema,canvas:external_exports2.string(),shape:external_exports2.array(SingleLetterShapeSchema),BBox:BBoxSchema,colors:external_exports2.union([external_exports2.array(external_exports2.string()),external_exports2.record(external_exports2.string())])}),PackageDetailDataStrSchema=external_exports2.object({head:HeadSchema,canvas:external_exports2.string(),shape:external_exports2.array(external_exports2.string()).transform(shapes=>shapes.map(shape=>{let[type,...data]=shape.split("~");return ShapeItemSchema.parse({type,data:data.join("~")})})).pipe(external_exports2.array(PackageDetailShapeSchema)),layers:external_exports2.array(external_exports2.string()).transform(layers=>layers.map(layer=>{let[name,color,visible,active,config,transparency]=layer.split("~");return LayerItemSchema.parse({name,color,visible:visible==="true",active:active==="true",config:config==="true",transparency:transparency==="true"})})),objects:external_exports2.array(external_exports2.string()).transform(objects=>objects.map(obj=>{let[name,visible,locked]=obj.split("~");return ObjectItemSchema.parse({name,visible:visible==="true",locked:locked==="true"})})),BBox:BBoxSchema,netColors:external_exports2.array(external_exports2.unknown()).optional()}),PackageDetailSchema=external_exports2.object({uuid:external_exports2.string(),title:external_exports2.string(),docType:external_exports2.number(),updateTime:external_exports2.number(),owner:OwnerSchema,datastrid:external_exports2.string(),writable:external_exports2.boolean(),dataStr:PackageDetailDataStrSchema}),ModelBoundsSchema=external_exports2.object({min:external_exports2.object({x:external_exports2.number(),y:external_exports2.number(),z:external_exports2.number()}),max:external_exports2.object({x:external_exports2.number(),y:external_exports2.number(),z:external_exports2.number()})}),EasyEdaJsonSchema=external_exports2.object({uuid:external_exports2.string(),title:external_exports2.string(),description:external_exports2.string(),docType:external_exports2.number(),type:external_exports2.number(),szlcsc:SzlcscSchema,lcsc:LcscSchema,owner:OwnerSchema,tags:external_exports2.array(external_exports2.string()),category:external_exports2.string().optional(),updateTime:external_exports2.number(),updated_at:external_exports2.string(),dataStr:DataStrSchema,verify:external_exports2.boolean(),SMT:external_exports2.boolean().optional(),datastrid:external_exports2.string(),jlcOnSale:external_exports2.number().optional(),writable:external_exports2.boolean(),isFavorite:external_exports2.boolean(),packageDetail:PackageDetailSchema,_objMetadata:external_exports2.object({bounds:ModelBoundsSchema}).optional()}),getModelObjCdnUrl=({easyedaModelUuid,easyedaPartNumber})=>`https://modelcdn.tscircuit.com/easyeda_models/assets/${easyedaPartNumber}.obj?uuid=${easyedaModelUuid}`,getModelCdnUrl=getModelObjCdnUrl,getModelUuidFromRawPackageDetail=result=>{let shapes=result.packageDetail?.dataStr?.shape;if(!Array.isArray(shapes))return null;for(let shape of shapes){if(typeof shape!="string"||!shape.startsWith("SVGNODE~"))continue;let svgNodeJson=shape.slice(8);try{let modelUuid=JSON.parse(svgNodeJson)?.attrs?.uuid;if(typeof modelUuid=="string"&&modelUuid.length>0)return modelUuid}catch{}}return null},parseObjBounds2=objText=>{let minX=Number.POSITIVE_INFINITY,minY=Number.POSITIVE_INFINITY,minZ=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY,maxZ=Number.NEGATIVE_INFINITY,vertexCount=0;for(let line2 of objText.split(/\r?\n/)){let trimmed=line2.trim();if(!trimmed.startsWith("v "))continue;let[,xStr,yStr,zStr]=trimmed.split(/\s+/,4),x4=Number(xStr),y4=Number(yStr),z4=Number(zStr);!Number.isFinite(x4)||!Number.isFinite(y4)||!Number.isFinite(z4)||(vertexCount+=1,minX=Math.min(minX,x4),minY=Math.min(minY,y4),minZ=Math.min(minZ,z4),maxX=Math.max(maxX,x4),maxY=Math.max(maxY,y4),maxZ=Math.max(maxZ,z4))}return vertexCount===0?null:{min:{x:minX,y:minY,z:minZ},max:{x:maxX,y:maxY,z:maxZ}}};async function fetchEasyEDAComponent(jlcpcbPartNumber,{fetch:fetch22=globalThis.fetch,includeModelMetadata=!0}={}){let searchUrl="https://easyeda.com/api/components/search",componentUrl=uuid=>`https://easyeda.com/api/components/${uuid}?version=6.4.7&uuid=${uuid}&datastrid=`,searchHeaders={authority:"easyeda.com",pragma:"no-cache","cache-control":"no-cache",accept:"application/json, text/javascript, */*; q=0.01","x-requested-with":"XMLHttpRequest","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36","content-type":"application/x-www-form-urlencoded; charset=UTF-8",origin:"https://easyeda.com","sec-fetch-site":"same-origin","sec-fetch-mode":"cors","sec-fetch-dest":"empty",referer:"https://easyeda.com/editor","accept-language":"cs,en;q=0.9,sk;q=0.8,en-GB;q=0.7",cookie:"<PUT your cookies here>"},searchData=`type=3&doctype%5B%5D=2&uid=0819f05c4eef4c71ace90d822a990e87&returnListStyle=classifyarr&wd=${jlcpcbPartNumber}&version=6.4.7`,searchResponse=await fetch22(searchUrl,{method:"POST",headers:searchHeaders,body:searchData});if(!searchResponse.ok)throw new Error("Failed to search for the component");let searchResult=await searchResponse.json();if(!searchResult.success||!searchResult.result.lists.lcsc.length)throw new Error("Component not found");let componentUUID=(searchResult.result.lists.lcsc.find(component=>component.dataStr.head.c_para["Supplier Part"]===jlcpcbPartNumber)??searchResult.result.lists.lcsc[0]).uuid,componentResponse=await fetch22(componentUrl(componentUUID),{method:"GET",headers:{...searchHeaders,referer:`https://easyeda.com/editor?uuid=${componentUUID}`}});if(!componentResponse.ok)throw new Error("Failed to fetch the component details");let result=(await componentResponse.json()).result;if(includeModelMetadata){let modelUuid=getModelUuidFromRawPackageDetail(result),partNumber=result.lcsc?.number;if(modelUuid&&partNumber)try{let objUrl=getModelCdnUrl({easyedaModelUuid:modelUuid,easyedaPartNumber:partNumber}),objResponse=await fetch22(objUrl);if(objResponse.ok){let objText=await objResponse.text(),bounds=parseObjBounds2(objText);bounds&&(result._objMetadata={bounds})}}catch(error2){console.error(`Error fetching model metadata for ${jlcpcbPartNumber}:`,error2)}}return result}var getFootprinterStringFromKicad=kicadFootprint=>{let match2=kicadFootprint.match(/:[RC]_(\d{4})_/);if(match2||(match2=kicadFootprint.match(/:(SOIC-\d+|SOT-\d+|SOD-\d+|SSOP-\d+|TSSOP-\d+|QFP-\d+|QFN-\d+)/),match2))return match2[1]},getJlcPackageFromFootprinterString=footprinterString=>footprinterString.includes("cap")?footprinterString.replace(/cap/g,""):footprinterString,getJlcpcbPackageName=footprint=>{if(footprint){if(footprint.startsWith("kicad:")){let footprinterString=getFootprinterStringFromKicad(footprint);return footprinterString?getJlcPackageFromFootprinterString(footprinterString):footprint}return getJlcPackageFromFootprinterString(footprint)}},EASYEDA_API_ORIGIN="https://easyeda.com",METHODS_WITHOUT_BODY=new Set(["GET","HEAD"]),getRequestUrl=requestInput=>typeof requestInput=="string"?requestInput:requestInput instanceof URL?requestInput.toString():requestInput.url,createMergedTargetRequest=(requestInput,requestInit)=>requestInput instanceof URL?new Request(requestInput.toString(),requestInit):typeof requestInput=="string"?new Request(requestInput,requestInit):new Request(requestInput,requestInit),isEasyEdaApiRequestUrl=requestUrl=>requestUrl.startsWith(`${EASYEDA_API_ORIGIN}/api/`),getFetchWithEasyEdaProxy=({platformFetch:upstreamFetch,easyEdaProxyConfig})=>async(requestInput,requestInit)=>{let targetRequestUrl=getRequestUrl(requestInput);if(!isEasyEdaApiRequestUrl(targetRequestUrl))return upstreamFetch(requestInput,requestInit);let mergedTargetRequest=createMergedTargetRequest(requestInput,requestInit),targetRequestHeaders=new Headers(mergedTargetRequest.headers),proxyRequestHeaders=new Headers(targetRequestHeaders);proxyRequestHeaders.delete("origin"),proxyRequestHeaders.delete("authority"),proxyRequestHeaders.delete("host"),proxyRequestHeaders.delete("referer"),proxyRequestHeaders.delete("user-agent"),proxyRequestHeaders.delete("cookie"),proxyRequestHeaders.set("X-Target-Url",targetRequestUrl),proxyRequestHeaders.set("X-Sender-Origin",targetRequestHeaders.get("origin")??""),proxyRequestHeaders.set("X-Sender-Host",targetRequestHeaders.get("host")??EASYEDA_API_ORIGIN),proxyRequestHeaders.set("X-Sender-Referer",targetRequestHeaders.get("referer")??""),proxyRequestHeaders.set("X-Sender-User-Agent",targetRequestHeaders.get("user-agent")??""),proxyRequestHeaders.set("X-Sender-Cookie",targetRequestHeaders.get("cookie")??""),proxyRequestHeaders.set("authority",targetRequestHeaders.get("authority")??targetRequestHeaders.get("host")??""),proxyRequestHeaders.set("content-type",targetRequestHeaders.get("content-type")??"");for(let[name,value]of Object.entries(easyEdaProxyConfig.headers??{}))proxyRequestHeaders.set(name,value);let proxyRequestBody=METHODS_WITHOUT_BODY.has(mergedTargetRequest.method)?void 0:await mergedTargetRequest.clone().arrayBuffer();return upstreamFetch(easyEdaProxyConfig.proxyEndpointUrl,{method:mergedTargetRequest.method,headers:proxyRequestHeaders,body:proxyRequestBody,signal:requestInit?.signal})},cache=new Map,getJlcPartsCached=async(name,params)=>{let paramString=new URLSearchParams({...params,json:"true"}).toString();if(cache.has(paramString))return cache.get(paramString);let responseJson=await(await fetch(`https://jlcsearch.tscircuit.com/${name}/list?${paramString}`)).json();return cache.set(paramString,responseJson),responseJson},withBasicPartPreference=parts=>parts?[...parts].sort((a3,b3)=>Number(b3.is_basic??!1)-Number(a3.is_basic??!1)):[],JlcPcbPartsEngine=class{constructor({platformFetch:defaultPlatformFetch,easyEdaProxyConfig}={}){__publicField(this,"defaultPlatformFetch");__publicField(this,"easyEdaProxyConfig");this.defaultPlatformFetch=defaultPlatformFetch,this.easyEdaProxyConfig=easyEdaProxyConfig,this.fetchPartCircuitJson=this.fetchPartCircuitJson.bind(this)}getEasyEdaPlatformFetch(platformFetchOverride){let resolvedPlatformFetch=platformFetchOverride??this.defaultPlatformFetch??globalThis.fetch;return this.easyEdaProxyConfig?getFetchWithEasyEdaProxy({platformFetch:resolvedPlatformFetch,easyEdaProxyConfig:this.easyEdaProxyConfig}):resolvedPlatformFetch}async findPart({sourceComponent,footprinterString}){let jlcpcbPackage=getJlcpcbPackageName(footprinterString);if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_resistor"){let{resistors}=await getJlcPartsCached("resistors",{resistance:sourceComponent.resistance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(resistors).map(r5=>`C${r5.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_capacitor"){let{capacitors}=await getJlcPartsCached("capacitors",{capacitance:sourceComponent.capacitance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(capacitors).map(c4=>`C${c4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_pin_header"){let pitch;footprinterString?.includes("_p")&&(pitch=Number(footprinterString.split("_p")[1]));let{headers}=await getJlcPartsCached("headers",pitch?{pitch,num_pins:sourceComponent.pin_count,gender:sourceComponent.gender}:{num_pins:sourceComponent.pin_count,gender:sourceComponent.gender});return{jlcpcb:withBasicPartPreference(headers).map(h6=>`C${h6.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_potentiometer"){let{potentiometers}=await getJlcPartsCached("potentiometers",{resistance:sourceComponent.max_resistance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(potentiometers).map(p4=>`C${p4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_diode"){let{diodes}=await getJlcPartsCached("diodes",{package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(diodes).map(d4=>`C${d4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_chip"){if(!jlcpcbPackage||!footprinterString)return{};let{chips}=await getJlcPartsCached("chips",{package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(chips).map(c4=>`C${c4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_transistor"){let{transistors}=await getJlcPartsCached("transistors",{package:jlcpcbPackage,transistor_type:sourceComponent.transistor_type});return{jlcpcb:withBasicPartPreference(transistors).map(t52=>`C${t52.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_power_source"){let{power_sources}=await getJlcPartsCached("power_sources",{voltage:sourceComponent.voltage,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(power_sources).map(p4=>`C${p4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_inductor"){let{inductors}=await getJlcPartsCached("inductors",{inductance:sourceComponent.inductance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(inductors).map(i3=>`C${i3.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_crystal"){let{crystals}=await getJlcPartsCached("crystals",{frequency:sourceComponent.frequency,load_capacitance:sourceComponent.load_capacitance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(crystals).map(c4=>`C${c4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_mosfet"){let{mosfets}=await getJlcPartsCached("mosfets",{package:jlcpcbPackage,mosfet_mode:sourceComponent.mosfet_mode,channel_type:sourceComponent.channel_type});return{jlcpcb:withBasicPartPreference(mosfets).map(m4=>`C${m4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_resonator"){let{resonators}=await getJlcPartsCached("resonators",{frequency:sourceComponent.frequency,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(resonators).map(r5=>`C${r5.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_switch"){let{switches}=await getJlcPartsCached("switches",{switch_type:sourceComponent.type,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(switches).map(s3=>`C${s3.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_led"){let{leds}=await getJlcPartsCached("leds",{package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(leds).map(l4=>`C${l4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_fuse"){let{fuses}=await getJlcPartsCached("fuses",{package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(fuses).map(l4=>`C${l4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_connector"&&sourceComponent.standard==="usb_c"){let{usb_c_connectors}=await getJlcPartsCached("usb_c_connectors",{});return{jlcpcb:withBasicPartPreference(usb_c_connectors).map(c4=>`C${c4.lcsc}`).slice(0,3)}}return{}}async fetchPartCircuitJson({supplierPartNumber,manufacturerPartNumber,platformFetch:platformFetchOverride}){let easyEdaPlatformFetch=this.getEasyEdaPlatformFetch(platformFetchOverride),resolvedSupplierPartNumber=supplierPartNumber;if(!resolvedSupplierPartNumber&&manufacturerPartNumber){let{components}=await getJlcPartsCached("components",{search:manufacturerPartNumber});resolvedSupplierPartNumber=components?.[0]?`C${components[0].lcsc}`:void 0}if(!resolvedSupplierPartNumber)return;let rawEasyEdaJson=await fetchEasyEDAComponent(resolvedSupplierPartNumber,{fetch:easyEdaPlatformFetch}),parsed=EasyEdaJsonSchema.parse(rawEasyEdaJson);return convertEasyEdaJsonToCircuitJson(parsed)}},jlcPartsEngine=new JlcPcbPartsEngine;var import_s_expression=__toESM(require_s_expression(),1);init_zod();var import_debug20=__toESM(require_browser(),1),import_debug21=__toESM(require_browser(),1),point22=external_exports.tuple([external_exports.coerce.number(),external_exports.coerce.number()]),point34=external_exports.tuple([external_exports.number(),external_exports.number(),external_exports.number()]),point6=external_exports.union([point22,point34]),fp_poly_arc_segment_def=external_exports.object({kind:external_exports.literal("arc"),start:point22,mid:point22,end:point22}),fp_poly_point_def=external_exports.union([point22,fp_poly_arc_segment_def]),attributes_def=external_exports.object({at:point6,size:point22,layer:external_exports.string(),layers:external_exports.array(external_exports.string()),roundrect_rratio:external_exports.number(),uuid:external_exports.string()}).partial(),property_def=external_exports.object({key:external_exports.string(),val:external_exports.string(),attributes:attributes_def}),drill_def=external_exports.object({oval:external_exports.boolean().default(!1),width:external_exports.number().optional(),height:external_exports.number().optional(),offset:point22.optional()}),hole_def=external_exports.object({name:external_exports.string(),pad_type:external_exports.enum(["thru_hole","smd","np_thru_hole","connect"]),pad_shape:external_exports.enum(["roundrect","circle","rect","oval","trapezoid","custom"]),at:point6,drill:external_exports.union([external_exports.number(),external_exports.array(external_exports.any()),drill_def]).transform(a3=>typeof a3=="number"?{oval:!1,width:a3,height:a3}:"oval"in a3?a3:a3.length===2?{oval:!1,width:Number.parseFloat(a3[0]),height:Number.parseFloat(a3[0]),offset:point22.parse(a3[1].slice(1))}:a3.length===3||a3.length===4?{oval:a3[0]==="oval",width:Number.parseFloat(a3[1]),height:Number.parseFloat(a3[2]),offset:a3[3]?point22.parse(a3[3].slice(1)):void 0}:a3).pipe(drill_def),size:external_exports.union([external_exports.array(external_exports.number()).length(2).transform(([w4,h6])=>({width:w4,height:h6})),external_exports.object({width:external_exports.number(),height:external_exports.number()})]),layers:external_exports.array(external_exports.string()).optional(),roundrect_rratio:external_exports.number().optional(),uuid:external_exports.string().optional()}),pad_def2=external_exports.object({name:external_exports.string(),pad_type:external_exports.enum(["thru_hole","smd","np_thru_hole","connect"]),pad_shape:external_exports.enum(["roundrect","circle","rect","oval","trapezoid","custom"]),at:point6,size:point22,drill:external_exports.union([external_exports.number(),external_exports.array(external_exports.any()),drill_def]).transform(a3=>typeof a3=="number"?{oval:!1,width:a3,height:a3}:"oval"in a3?a3:a3.length===2?{oval:!1,width:Number.parseFloat(a3[0]),height:Number.parseFloat(a3[0]),offset:point22.parse(a3[1].slice(1))}:a3.length===3||a3.length===4?{oval:a3[0]==="oval",width:Number.parseFloat(a3[1]),height:Number.parseFloat(a3[2]),offset:a3[3]?point22.parse(a3[3].slice(1)):void 0}:a3).pipe(drill_def).optional(),layers:external_exports.array(external_exports.string()).optional(),roundrect_rratio:external_exports.number().optional(),chamfer_ratio:external_exports.number().optional(),solder_paste_margin:external_exports.number().optional(),solder_paste_margin_ratio:external_exports.number().optional(),clearance:external_exports.number().optional(),zone_connection:external_exports.union([external_exports.literal(0).describe("Pad is not connect to zone"),external_exports.literal(1).describe("Pad is connected to zone using thermal relief"),external_exports.literal(2).describe("Pad is connected to zone using solid fill")]).optional(),thermal_width:external_exports.number().optional(),thermal_gap:external_exports.number().optional(),uuid:external_exports.string().optional()}),effects_def=external_exports.object({font:external_exports.object({size:point22,thickness:external_exports.number().optional()})}).partial(),fp_text_def=external_exports.object({fp_text_type:external_exports.literal("user"),text:external_exports.string(),at:point6,layer:external_exports.string(),uuid:external_exports.string().optional(),effects:effects_def.partial()}),fp_arc_def=external_exports.object({start:point22,mid:point22,end:point22,stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}),layer:external_exports.string(),uuid:external_exports.string().optional()}),fp_circle_def=external_exports.object({center:point22,end:point22,stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}),fill:external_exports.string().optional(),layer:external_exports.string(),uuid:external_exports.string().optional()}),fp_poly_def=external_exports.object({pts:external_exports.array(fp_poly_point_def),stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}).optional(),width:external_exports.number().optional(),layer:external_exports.string(),uuid:external_exports.string().optional(),fill:external_exports.string().optional()}).transform(data=>({...data,width:void 0,stroke:data.stroke??{width:data.width}})),fp_rect_def=external_exports.object({start:point22,end:point22,stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}).optional(),width:external_exports.number().optional(),fill:external_exports.string().optional(),layer:external_exports.string(),uuid:external_exports.string().optional()}).transform(data=>({...data,width:void 0,stroke:data.stroke??{width:data.width}})),fp_line=external_exports.object({start:point22,end:point22,stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}).optional(),width:external_exports.number().optional(),layer:external_exports.string(),uuid:external_exports.string().optional()}).transform(data=>({...data,width:void 0,stroke:data.stroke??{width:data.width}})),kicad_mod_json_def=external_exports.object({footprint_name:external_exports.string(),version:external_exports.string().optional(),generator:external_exports.string().optional(),generator_version:external_exports.string().optional(),layer:external_exports.string(),descr:external_exports.string().default(""),tags:external_exports.array(external_exports.string()).optional(),properties:external_exports.array(property_def),fp_lines:external_exports.array(fp_line),fp_rects:external_exports.array(fp_rect_def).optional(),fp_texts:external_exports.array(fp_text_def),fp_arcs:external_exports.array(fp_arc_def),fp_circles:external_exports.array(fp_circle_def).optional(),fp_polys:external_exports.array(fp_poly_def).optional(),pads:external_exports.array(pad_def2),holes:external_exports.array(hole_def).optional()}),formatAttr=(val,attrKey)=>{if(attrKey==="effects"&&Array.isArray(val)){let effectsObj={};for(let elm of val)if(elm[0]==="font"){let fontObj={};for(let fontElm of elm.slice(1))fontElm.length===2?fontObj[fontElm[0].valueOf()]=Number.parseFloat(fontElm[1].valueOf()):fontObj[fontElm[0].valueOf()]=fontElm.slice(1).map(n4=>Number.parseFloat(n4.valueOf()));effectsObj.font=fontObj}return effects_def.parse(effectsObj)}if(attrKey==="pts")return val.map(segment2=>{let segmentType=segment2[0]?.valueOf?.()??segment2[0];if(segmentType==="xy")return segment2.slice(1).map(n4=>Number.parseFloat(n4.valueOf()));if(segmentType==="arc"){let arcObj={kind:"arc"};for(let arcAttr of segment2.slice(1)){let key=arcAttr[0].valueOf();arcObj[key]=arcAttr.slice(1).map(n4=>Number.parseFloat(n4.valueOf()))}return arcObj}return segment2});if(attrKey==="stroke"){let strokeObj={};for(let strokeElm of val){let strokePropKey=strokeElm[0].valueOf();strokeObj[strokePropKey]=formatAttr(strokeElm.slice(1),strokePropKey)}return strokeObj}return attrKey==="at"||attrKey==="size"||attrKey==="start"||attrKey==="mid"||attrKey==="end"?(Array.isArray(val)?val:[val]).map(n4=>n4?.valueOf?.()??n4).filter(v4=>typeof v4=="number"||typeof v4=="string"&&/^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(v4)).map(v4=>typeof v4=="number"?v4:Number.parseFloat(v4)):attrKey==="tags"?val.map(n4=>n4.valueOf()):attrKey==="generator_version"||attrKey==="version"?val[0].valueOf():val.length===2?val.valueOf():attrKey==="uuid"?Array.isArray(val)?val[0].valueOf():val.valueOf():/^[\d\.]+$/.test(val)&&!Number.isNaN(Number.parseFloat(val))?Number.parseFloat(val):Array.isArray(val)&&val.length===1?val[0].valueOf():Array.isArray(val)?val.map(s3=>s3.valueOf()):val},getAttr=(s3,key)=>{for(let elm of s3)if(Array.isArray(elm)&&elm[0]===key)return formatAttr(elm.slice(1),key)},debug11=(0,import_debug20.default)("kicad-mod-converter"),parseKicadModToKicadJson=fileContent=>{let kicadSExpr=(0,import_s_expression.default)(fileContent),footprintName=kicadSExpr[1].valueOf(),topLevelAttributes={},simpleTopLevelAttributes=Object.entries(kicad_mod_json_def.shape).filter(([attributeKey,def])=>def._def.typeName==="ZodString"||attributeKey==="tags").map(([attributeKey])=>attributeKey);for(let kicadSExprRow of kicadSExpr.slice(2)){if(!simpleTopLevelAttributes.includes(kicadSExprRow[0]))continue;let key=kicadSExprRow[0].valueOf(),val=formatAttr(kicadSExprRow.slice(1),key);topLevelAttributes[key]=val}let properties=kicadSExpr.slice(2).filter(row=>row[0]==="property").map(row=>{let key=row[1].valueOf(),val=row[2].valueOf(),attributes2=attributes_def.parse(row.slice(3).reduce((acc,attrAr)=>{let attrKey=attrAr[0].valueOf();return acc[attrKey]=formatAttr(attrAr.slice(1),attrKey),acc},{}));return{key,val,attributes:attributes2}}),padRows=kicadSExpr.slice(2).filter(row=>row[0]==="pad"),pads=[];for(let row of padRows){let at3=getAttr(row,"at"),size3=getAttr(row,"size"),drill=getAttr(row,"drill"),layers=getAttr(row,"layers");Array.isArray(layers)?layers=layers.map(layer=>layer.valueOf()):typeof layers=="string"?layers=[layers]:layers||(layers=[]);let padType=row[2].valueOf(),isCu=layers.some(l4=>l4.endsWith(".Cu")||l4==="*.Cu"||l4.includes(".Cu"));if(padType==="thru_hole")continue;if(!isCu&&padType!=="np_thru_hole"){debug11(`Skipping pad without copper layer: layers=${layers.join(", ")}`);continue}let roundrect_rratio=getAttr(row,"roundrect_rratio"),uuid=getAttr(row,"uuid"),padRaw={name:row[1].valueOf(),pad_type:row[2].valueOf(),pad_shape:row[3].valueOf(),at:at3,drill,size:size3,layers,roundrect_rratio,uuid};debug11(`attempting to parse pad: ${JSON.stringify(padRaw,null," ")}`),pads.push(pad_def2.parse(padRaw))}let fp_texts_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_text"),fp_texts=[];for(let fp_text_row of fp_texts_rows){let text=fp_text_row[2].valueOf(),at3=getAttr(fp_text_row,"at"),layer=getAttr(fp_text_row,"layer"),uuid=getAttr(fp_text_row,"uuid"),effects=getAttr(fp_text_row,"effects");fp_texts.push({fp_text_type:"user",text,at:at3,layer,uuid,effects})}let fp_lines=[],fp_lines_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_line");for(let fp_line_row of fp_lines_rows){let start=getAttr(fp_line_row,"start"),end=getAttr(fp_line_row,"end"),stroke=getAttr(fp_line_row,"stroke"),layer=getAttr(fp_line_row,"layer"),uuid=getAttr(fp_line_row,"uuid");fp_lines.push({start,end,stroke,layer,uuid})}let fp_rects=[],fp_rect_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_rect");for(let fp_rect_row of fp_rect_rows){let start=getAttr(fp_rect_row,"start"),end=getAttr(fp_rect_row,"end"),stroke=getAttr(fp_rect_row,"stroke"),layer=getAttr(fp_rect_row,"layer"),fill=getAttr(fp_rect_row,"fill"),uuid=getAttr(fp_rect_row,"uuid");!start||!end||!layer||fp_rects.push({start,end,stroke,fill,layer,uuid})}let fp_arcs=[],fp_arcs_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_arc");for(let fp_arc_row of fp_arcs_rows){let start=getAttr(fp_arc_row,"start"),mid=getAttr(fp_arc_row,"mid"),end=getAttr(fp_arc_row,"end"),stroke=getAttr(fp_arc_row,"stroke"),layer=getAttr(fp_arc_row,"layer"),uuid=getAttr(fp_arc_row,"uuid");!start||!end||!mid||!stroke||!layer||fp_arcs.push({start,mid,end,stroke,layer,uuid})}let fp_circles=[],fp_circles_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_circle");for(let fp_circle_row of fp_circles_rows){let center2=getAttr(fp_circle_row,"center"),end=getAttr(fp_circle_row,"end"),stroke=getAttr(fp_circle_row,"stroke"),fill=getAttr(fp_circle_row,"fill"),layer=getAttr(fp_circle_row,"layer"),uuid=getAttr(fp_circle_row,"uuid");!center2||!end||!stroke||!layer||fp_circles.push({center:center2,end,stroke,fill,layer,uuid})}let fp_polys=[],fp_polys_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_poly");for(let fp_poly_row of fp_polys_rows){let pts=getAttr(fp_poly_row,"pts"),stroke=getAttr(fp_poly_row,"stroke"),width=getAttr(fp_poly_row,"width"),layer=getAttr(fp_poly_row,"layer"),uuid=getAttr(fp_poly_row,"uuid"),fill=getAttr(fp_poly_row,"fill"),normalizedStroke=stroke;!normalizedStroke&&typeof width=="number"?normalizedStroke={width,type:"solid"}:normalizedStroke&&typeof normalizedStroke=="object"&&typeof width=="number"&&normalizedStroke.width===void 0&&(normalizedStroke={...normalizedStroke,width}),fp_polys.push({pts,stroke:normalizedStroke,layer,uuid,fill})}let holes=[];for(let row of kicadSExpr.slice(2)){if(row[0]!=="pad"||row[2]?.valueOf?.()!=="thru_hole")continue;let name=row[1]?.valueOf?.(),pad_type=row[2]?.valueOf?.(),pad_shape=row[3]?.valueOf?.(),at3=getAttr(row,"at"),drill=getAttr(row,"drill"),size3=getAttr(row,"size");Array.isArray(size3)&&(size3[0]==="size"&&(size3=size3.slice(1)),size3={width:Number(size3[0]),height:Number(size3[1])});let uuid=getAttr(row,"uuid"),roundrect_rratio=getAttr(row,"roundrect_rratio"),layers=getAttr(row,"layers");Array.isArray(layers)?layers=layers.map(layer=>layer.valueOf()):typeof layers=="string"?layers=[layers]:layers||(layers=[]);let holeRaw={name,pad_type,pad_shape,at:at3,drill,size:size3,layers,roundrect_rratio,uuid};debug11(`attempting to parse holes: ${JSON.stringify(holeRaw,null,2)}`),holes.push(hole_def.parse(holeRaw))}return kicad_mod_json_def.parse({footprint_name:footprintName,...topLevelAttributes,properties,fp_lines,fp_rects,fp_texts,fp_arcs,fp_circles,pads,holes,fp_polys})},TWO_PI=Math.PI*2,normalizeAngle2=angle=>{let result=angle%TWO_PI;return result<0&&(result+=TWO_PI),result},directedAngleCCW=(start,target)=>{let startNorm=normalizeAngle2(start),delta=normalizeAngle2(target)-startNorm;return delta<0&&(delta+=TWO_PI),delta};function calculateCenter(start,mid,end){let mid1={x:(start.x+mid.x)/2,y:(start.y+mid.y)/2},mid2={x:(mid.x+end.x)/2,y:(mid.y+end.y)/2},slope1=-(start.x-mid.x)/(start.y-mid.y),slope2=-(mid.x-end.x)/(mid.y-end.y),centerX=(mid1.y-mid2.y+slope2*mid2.x-slope1*mid1.x)/(slope2-slope1),centerY=mid1.y+slope1*(centerX-mid1.x);return{x:centerX,y:centerY}}function calculateRadius(center2,point42){return Math.sqrt((center2.x-point42.x)**2+(center2.y-point42.y)**2)}function calculateAngle(center2,point42){return Math.atan2(point42.y-center2.y,point42.x-center2.x)}var getArcLength2=(start,mid,end)=>{let center2=calculateCenter(start,mid,end),radius=calculateRadius(center2,start),angleStart=calculateAngle(center2,start),angleMid=calculateAngle(center2,mid),angleEnd=calculateAngle(center2,end),ccwToMid=directedAngleCCW(angleStart,angleMid),ccwToEnd=directedAngleCCW(angleStart,angleEnd),angleDelta=ccwToEnd;return ccwToMid>ccwToEnd&&(angleDelta=ccwToEnd-TWO_PI),Math.abs(radius*angleDelta)};function generateArcPath(start,mid,end,numPoints){let center2=calculateCenter(start,mid,end),radius=calculateRadius(center2,start),angleStart=calculateAngle(center2,start),angleMid=calculateAngle(center2,mid),angleEnd=calculateAngle(center2,end),ccwToMid=directedAngleCCW(angleStart,angleMid),ccwToEnd=directedAngleCCW(angleStart,angleEnd),angleDelta=ccwToEnd;ccwToMid>ccwToEnd&&(angleDelta=ccwToEnd-TWO_PI);let path=[];for(let i3=0;i3<=numPoints;i3++){let angle=angleStart+i3/numPoints*angleDelta,x4=center2.x+radius*Math.cos(angle),y4=center2.y+radius*Math.sin(angle);path.push({x:x4,y:y4})}return path}var makePoint=p4=>Array.isArray(p4)?{x:p4[0],y:p4[1]}:p4,pointsEqual4=(p12,p22,tolerance=1e-4)=>Math.abs(p12.x-p22.x)<tolerance&&Math.abs(p12.y-p22.y)<tolerance,findClosedPolygons=segments=>{let polygons=[],used=new Set;for(let i3=0;i3<segments.length;i3++){if(used.has(i3))continue;let polygon2=[segments[i3]];used.add(i3);let currentEnd=segments[i3].end,foundNext=!0;for(;foundNext;){if(foundNext=!1,polygon2.length>1&&pointsEqual4(currentEnd,polygon2[0].start)){polygons.push(polygon2);break}for(let j4=0;j4<segments.length;j4++)if(!used.has(j4)){if(pointsEqual4(currentEnd,segments[j4].start)){polygon2.push(segments[j4]),used.add(j4),currentEnd=segments[j4].end,foundNext=!0;break}else if(pointsEqual4(currentEnd,segments[j4].end)){segments[j4].type==="arc"?polygon2.push({...segments[j4],reversed:!0}):polygon2.push({...segments[j4],start:segments[j4].end,end:segments[j4].start}),used.add(j4),currentEnd=segments[j4].start,foundNext=!0;break}}if(!foundNext){for(let k4=polygon2.length-1;k4>=0;k4--){let idx=segments.indexOf(polygon2[k4]);idx!==-1&&used.delete(idx)}break}}}return polygons},polygonToPoints=polygon2=>{let points=[];for(let segment2 of polygon2)if(segment2.type==="line")points.push(segment2.start);else if(segment2.type==="arc"&&segment2.mid){let arcLength2=getArcLength2(segment2.start,segment2.mid,segment2.end),numPoints=Math.max(3,Math.ceil(arcLength2)),arcPoints=generateArcPath(segment2.start,segment2.mid,segment2.end,numPoints);segment2.reversed&&(arcPoints=arcPoints.reverse()),points.push(...arcPoints.slice(0,-1))}return points};function getSilkscreenFontSizeFromFpTexts(fp_texts){if(!Array.isArray(fp_texts))return null;let refText=fp_texts.find(t52=>t52.layer?.toLowerCase()==="f.silks"&&(t52.text?.includes("${REFERENCE}")||t52.fp_text_type?.toLowerCase()==="reference"||t52.text?.match(/^R\d+|C\d+|U\d+/))),fallbackText=refText||fp_texts.find(t52=>t52.layer?.toLowerCase()==="f.fab"&&(t52.text?.includes("${REFERENCE}")||t52.fp_text_type?.toLowerCase()==="reference")),target=refText||fallbackText;if(!target?.effects?.font?.size)return null;let[width,height]=target.effects.font.size;return height??width??1}var degToRad=deg=>deg*Math.PI/180,rotatePoint4=(x4,y4,deg)=>{let r5=degToRad(deg),cos6=Math.cos(r5),sin6=Math.sin(r5);return{x:x4*cos6-y4*sin6,y:x4*sin6+y4*cos6}},getAxisAlignedRectFromPoints=points=>{let uniquePoints=[...new Map(points.map(p4=>[`${p4.x},${p4.y}`,p4])).values()];if(uniquePoints.length!==4)return null;let xs3=uniquePoints.map(p4=>p4.x),ys3=uniquePoints.map(p4=>p4.y),uniqueXs=[...new Set(xs3)],uniqueYs=[...new Set(ys3)];if(uniqueXs.length!==2||uniqueYs.length!==2)return null;let[minX,maxX]=uniqueXs.sort((a3,b3)=>a3-b3),[minY,maxY]=uniqueYs.sort((a3,b3)=>a3-b3);return minX===void 0||maxX===void 0||minY===void 0||maxY===void 0?null:{x:(minX+maxX)/2,y:(minY+maxY)/2,width:maxX-minX,height:maxY-minY}},fpPolyHasFill=fill=>{if(!fill)return!1;let normalized=fill.toLowerCase();return normalized!=="no"&&normalized!=="none"&&normalized!=="outline"},getRotationDeg=at3=>at3&&Array.isArray(at3)&&at3.length>=3&&typeof at3[2]=="number"?at3[2]:0,isNinetyLike=deg=>{let n4=(deg%360+360)%360;return n4===90||n4===270},normalizePortName=name=>{if(name!=null)return`${name}`},getPinNumber=name=>{let normalized=normalizePortName(name),parsed=normalized!==void 0?Number(normalized):NaN;return Number.isFinite(parsed)?parsed:void 0},debug23=(0,import_debug21.default)("kicad-mod-converter"),convertKicadLayerToTscircuitLayer=kicadLayer=>{switch(kicadLayer.toLowerCase()){case"f.cu":case"f.fab":case"f.silks":case"f.crtyd":case"edge.cuts":return"top";case"b.cu":case"b.fab":case"b.silks":case"b.crtyd":return"bottom"}},convertKicadJsonToTsCircuitSoup=async kicadJson=>{let{fp_lines,fp_rects,fp_texts,fp_arcs,fp_circles,pads,properties,holes,fp_polys}=kicadJson,circuitJson=[];circuitJson.push({type:"source_component",source_component_id:"source_component_0",supplier_part_numbers:{}}),circuitJson.push({type:"schematic_component",schematic_component_id:"schematic_component_0",source_component_id:"source_component_0",center:{x:0,y:0},rotation:0,size:{width:0,height:0}});let portNames=new Set,portNameToPinNumber=new Map;for(let pad2 of pads){let portName=normalizePortName(pad2.name);if(portName){portNames.add(portName);let pinNumber=getPinNumber(pad2.name);pinNumber!==void 0&&portNameToPinNumber.set(portName,pinNumber)}}if(holes)for(let hole of holes){let portName=normalizePortName(hole.name);if(portName){portNames.add(portName);let pinNumber=getPinNumber(hole.name);pinNumber!==void 0&&portNameToPinNumber.set(portName,pinNumber)}}let sourcePortId=0,portNameToSourcePortId=new Map;for(let portName of portNames){let source_port_id=`source_port_${sourcePortId++}`;portNameToSourcePortId.set(portName,source_port_id);let pinNumber=portNameToPinNumber.get(portName);circuitJson.push({type:"source_port",source_port_id,source_component_id:"source_component_0",name:portName,port_hints:[portName],pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0}),circuitJson.push({type:"schematic_port",schematic_port_id:`schematic_port_${sourcePortId++}`,source_port_id,schematic_component_id:"schematic_component_0",center:{x:0,y:0}})}let minX=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,minY=Number.POSITIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY;for(let pad2 of pads){let x4=pad2.at[0],y4=-pad2.at[1],w4=pad2.size[0],h6=pad2.size[1];minX=Math.min(minX,x4-w4/2),maxX=Math.max(maxX,x4+w4/2),minY=Math.min(minY,y4-h6/2),maxY=Math.max(maxY,y4+h6/2)}let pcb_component_id="pcb_component_0";circuitJson.push({type:"pcb_component",source_component_id:"source_component_0",pcb_component_id,layer:"top",center:{x:0,y:0},rotation:0,width:Number.isFinite(minX)?maxX-minX:0,height:Number.isFinite(minY)?maxY-minY:0});let pcbPortId=0,portNameToPcbPortId=new Map;for(let portName of portNames){let pcb_port_id=`pcb_port_${pcbPortId++}`,source_port_id=portNameToSourcePortId.get(portName);portNameToPcbPortId.set(portName,pcb_port_id);let x4=0,y4=0,layers=["top","bottom"],pad2=pads.find(p4=>normalizePortName(p4.name)===portName);if(pad2)x4=pad2.at[0],y4=-pad2.at[1],layers=pad2.layers?pad2.layers.map(l4=>convertKicadLayerToTscircuitLayer(l4)).filter(Boolean):["top","bottom"];else if(holes){let hole=holes.find(h6=>normalizePortName(h6.name)===portName);hole&&(x4=hole.at[0],y4=-hole.at[1],layers=hole.layers?hole.layers.map(l4=>convertKicadLayerToTscircuitLayer(l4)).filter(Boolean):["top","bottom"])}circuitJson.push({type:"pcb_port",pcb_port_id,source_port_id,pcb_component_id,x:x4,y:y4,layers})}let smtpadId=0,platedHoleId=0,holeId=0;for(let pad2 of pads){let portName=normalizePortName(pad2.name),pinNumber=portName?portNameToPinNumber.get(portName):void 0;if(pad2.pad_type==="smd"){let rotation5=getRotationDeg(pad2.at),width=isNinetyLike(rotation5)?pad2.size[1]:pad2.size[0],height=isNinetyLike(rotation5)?pad2.size[0]:pad2.size[1],pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,pinLabel=pinNumber!==void 0?`pin${pinNumber}`:void 0;circuitJson.push({type:"pcb_smtpad",pcb_smtpad_id:`pcb_smtpad_${smtpadId++}`,shape:"rect",x:pad2.at[0],y:-pad2.at[1],width,height,layer:convertKicadLayerToTscircuitLayer(pad2.layers?.[0]??"F.Cu"),pcb_component_id,port_hints:pinLabel?[pinLabel]:portName?[portName]:[],pcb_port_id,pin_number:pinNumber,pin_label:pinLabel})}else if(pad2.pad_type==="thru_hole"){if(pad2.pad_shape==="rect"){let rotation5=getRotationDeg(pad2.at),width=isNinetyLike(rotation5)?pad2.size[1]:pad2.size[0],height=isNinetyLike(rotation5)?pad2.size[0]:pad2.size[1],offX=pad2.drill?.offset?.[0]??0,offY=pad2.drill?.offset?.[1]??0,rotOff=rotatePoint4(offX,offY,rotation5),pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,pinLabel=pinNumber!==void 0?`pin${pinNumber}`:void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circular_hole_with_rect_pad",hole_shape:"circle",pad_shape:"rect",x:pad2.at[0],y:-pad2.at[1],hole_offset_x:-rotOff.x,hole_offset_y:-rotOff.y,hole_diameter:pad2.drill?.width,rect_pad_width:width,rect_pad_height:height,layers:["top","bottom"],pcb_component_id,port_hints:pinLabel?[pinLabel]:portName?[portName]:[],pcb_port_id,pin_number:pinNumber,pin_label:pinLabel})}else if(pad2.pad_shape==="circle"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,pinLabel=pinNumber!==void 0?`pin${pinNumber}`:void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circle",x:pad2.at[0],y:-pad2.at[1],outer_diameter:pad2.size[0],hole_diameter:pad2.drill?.width,layers:["top","bottom"],pcb_component_id,port_hints:pinLabel?[pinLabel]:portName?[portName]:[],pcb_port_id,pin_number:pinNumber,pin_label:pinLabel})}else if(pad2.pad_shape==="oval"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,pinLabel=pinNumber!==void 0?`pin${pinNumber}`:void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"pill",x:pad2.at[0],y:-pad2.at[1],outer_width:pad2.size[0],outer_height:pad2.size[1],hole_width:pad2.drill?.width,hole_height:pad2.drill?.height,layers:["top","bottom"],pcb_component_id,port_hints:pinLabel?[pinLabel]:portName?[portName]:[],pcb_port_id,pin_number:pinNumber,pin_label:pinLabel})}}else pad2.pad_type==="np_thru_hole"&&pad2.pad_shape==="circle"&&circuitJson.push({type:"pcb_hole",pcb_hole_id:`pcb_hole_${holeId++}`,x:pad2.at[0],y:-pad2.at[1],hole_shape:"circle",hole_diameter:pad2.drill?.width??pad2.size[0],pcb_component_id})}if(holes)for(let hole of holes){let portName=normalizePortName(hole.name),pinNumber=portName?portNameToPinNumber.get(portName):void 0,hasCuLayer=hole.layers?.some(l4=>l4.endsWith(".Cu")||l4==="*.Cu"),rotation5=getRotationDeg(hole.at),offX=hole.drill?.offset?.[0]??0,offY=hole.drill?.offset?.[1]??0,rotOff=rotatePoint4(offX,offY,rotation5),x4=hole.at[0]+rotOff.x,y4=-(hole.at[1]+rotOff.y),holeDiameter=hole.drill?.width??0,outerDiameter=hole.size?.width??holeDiameter,rr3=hole.roundrect_rratio??0,rectBorderRadius=rr3>0?Math.min(isNinetyLike(rotation5)?hole.size?.height??outerDiameter:hole.size?.width??outerDiameter,isNinetyLike(rotation5)?hole.size?.width??outerDiameter:hole.size?.height??outerDiameter)/2*rr3:0;if(hasCuLayer)if(hole.pad_shape==="rect"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circular_hole_with_rect_pad",hole_shape:"circle",pad_shape:"rect",x:hole.at[0],y:-hole.at[1],hole_offset_x:-rotOff.x,hole_offset_y:-rotOff.y,hole_diameter:holeDiameter,rect_pad_width:isNinetyLike(rotation5)?hole.size?.height??outerDiameter:hole.size?.width??outerDiameter,rect_pad_height:isNinetyLike(rotation5)?hole.size?.width??outerDiameter:hole.size?.height??outerDiameter,rect_border_radius:rectBorderRadius,port_hints:pinNumber!==void 0?[`pin${pinNumber}`]:portName?[portName]:[],layers:["top","bottom"],pcb_component_id,pcb_port_id,pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0})}else if(hole.pad_shape==="oval"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"pill",x:x4,y:y4,outer_width:isNinetyLike(rotation5)?hole.size?.height??outerDiameter:hole.size?.width??outerDiameter,outer_height:isNinetyLike(rotation5)?hole.size?.width??outerDiameter:hole.size?.height??outerDiameter,hole_width:isNinetyLike(rotation5)?hole.drill?.height??holeDiameter:hole.drill?.width??holeDiameter,hole_height:isNinetyLike(rotation5)?hole.drill?.width??holeDiameter:hole.drill?.height??holeDiameter,port_hints:pinNumber!==void 0?[`pin${pinNumber}`]:portName?[portName]:[],layers:["top","bottom"],pcb_component_id,pcb_port_id,pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0})}else if(hole.pad_shape==="roundrect"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,offX2=hole.drill?.offset?.[0]??0,offY2=hole.drill?.offset?.[1]??0,rotOff2=rotatePoint4(offX2,offY2,rotation5),width=isNinetyLike(rotation5)?hole.size?.height??outerDiameter:hole.size?.width??outerDiameter,height=isNinetyLike(rotation5)?hole.size?.width??outerDiameter:hole.size?.height??outerDiameter;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circular_hole_with_rect_pad",hole_shape:"circle",pad_shape:"rect",x:x4,y:y4,hole_offset_x:-rotOff2.x,hole_offset_y:rotOff2.y,hole_diameter:holeDiameter,rect_pad_width:width,rect_pad_height:height,rect_border_radius:rectBorderRadius,port_hints:pinNumber!==void 0?[`pin${pinNumber}`]:portName?[portName]:[],layers:["top","bottom"],pcb_component_id,pcb_port_id,pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0})}else{let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circle",x:x4,y:y4,outer_diameter:outerDiameter,hole_diameter:holeDiameter,port_hints:pinNumber!==void 0?[`pin${pinNumber}`]:portName?[portName]:[],layers:["top","bottom"],pcb_component_id,pcb_port_id,pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0})}else circuitJson.push({type:"pcb_hole",pcb_hole_id:`pcb_hole_${holeId++}`,x:x4,y:y4,hole_shape:"circle",hole_diameter:holeDiameter,pcb_component_id})}let edgeCutSegments=[],frontCourtyardSegments=[],backCourtyardSegments=[];for(let fp_line2 of fp_lines){let lowerLayer=fp_line2.layer.toLowerCase();lowerLayer==="edge.cuts"?edgeCutSegments.push({type:"line",start:{x:fp_line2.start[0],y:fp_line2.start[1]},end:{x:fp_line2.end[0],y:fp_line2.end[1]},strokeWidth:fp_line2.stroke.width}):lowerLayer==="f.crtyd"?frontCourtyardSegments.push({type:"line",start:{x:fp_line2.start[0],y:fp_line2.start[1]},end:{x:fp_line2.end[0],y:fp_line2.end[1]},strokeWidth:fp_line2.stroke.width}):lowerLayer==="b.crtyd"&&backCourtyardSegments.push({type:"line",start:{x:fp_line2.start[0],y:fp_line2.start[1]},end:{x:fp_line2.end[0],y:fp_line2.end[1]},strokeWidth:fp_line2.stroke.width})}for(let fp_arc of fp_arcs){let lowerLayer=fp_arc.layer.toLowerCase();lowerLayer==="edge.cuts"?edgeCutSegments.push({type:"arc",start:{x:fp_arc.start[0],y:fp_arc.start[1]},mid:{x:fp_arc.mid[0],y:fp_arc.mid[1]},end:{x:fp_arc.end[0],y:fp_arc.end[1]},strokeWidth:fp_arc.stroke.width}):lowerLayer==="f.crtyd"?frontCourtyardSegments.push({type:"arc",start:{x:fp_arc.start[0],y:fp_arc.start[1]},mid:{x:fp_arc.mid[0],y:fp_arc.mid[1]},end:{x:fp_arc.end[0],y:fp_arc.end[1]},strokeWidth:fp_arc.stroke.width}):lowerLayer==="b.crtyd"&&backCourtyardSegments.push({type:"arc",start:{x:fp_arc.start[0],y:fp_arc.start[1]},mid:{x:fp_arc.mid[0],y:fp_arc.mid[1]},end:{x:fp_arc.end[0],y:fp_arc.end[1]},strokeWidth:fp_arc.stroke.width})}let closedPolygons=findClosedPolygons(edgeCutSegments),cutoutId=0;for(let polygon2 of closedPolygons){let points=polygonToPoints(polygon2);points.length>=3&&circuitJson.push({type:"pcb_cutout",pcb_cutout_id:`pcb_cutout_${cutoutId++}`,shape:"polygon",points:points.map(p4=>({x:p4.x,y:-p4.y})),pcb_component_id})}let courtyardOutlineId=0;for(let[segments,layer]of[[frontCourtyardSegments,"top"],[backCourtyardSegments,"bottom"]]){let closedCourtyardPolygons=findClosedPolygons(segments);for(let polygon2 of closedCourtyardPolygons){let points=polygonToPoints(polygon2);points.length>=3&&circuitJson.push({type:"pcb_courtyard_outline",pcb_courtyard_outline_id:`pcb_courtyard_outline_${courtyardOutlineId++}`,layer,pcb_component_id,outline:points.map(p4=>({x:p4.x,y:-p4.y}))})}}if(fp_rects)for(let fp_rect of fp_rects){let lowerLayer=fp_rect.layer.toLowerCase();if(lowerLayer==="f.crtyd"||lowerLayer==="b.crtyd"){let x12=fp_rect.start[0],y12=fp_rect.start[1],x22=fp_rect.end[0],y22=fp_rect.end[1];circuitJson.push({type:"pcb_courtyard_rect",pcb_courtyard_rect_id:`pcb_courtyard_rect_${courtyardOutlineId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_rect.layer),center:{x:(x12+x22)/2,y:-((y12+y22)/2)},width:Math.abs(x22-x12),height:Math.abs(y22-y12)})}else debug23("Unhandled layer for fp_rect",fp_rect.layer)}let traceId=0,silkPathId=0,fabPathId=0,noteLineId=0;for(let fp_line2 of fp_lines){let route=[{x:fp_line2.start[0],y:-fp_line2.start[1]},{x:fp_line2.end[0],y:-fp_line2.end[1]}],lowerLayer=fp_line2.layer.toLowerCase();lowerLayer==="f.cu"?circuitJson.push({type:"pcb_trace",pcb_trace_id:`pcb_trace_${traceId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_line2.layer),route,thickness:fp_line2.stroke.width}):lowerLayer==="f.silks"?circuitJson.push({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_path_${silkPathId++}`,pcb_component_id,layer:"top",route,stroke_width:fp_line2.stroke.width}):lowerLayer==="edge.cuts"?debug23("Skipping Edge.Cuts fp_line (converted to pcb_cutout)",fp_line2.layer):lowerLayer==="f.crtyd"||lowerLayer==="b.crtyd"?debug23("Skipping CrtYd fp_line (converted to pcb_courtyard_outline)",fp_line2.layer):lowerLayer==="f.fab"?circuitJson.push({type:"pcb_fabrication_note_path",fabrication_note_path_id:`fabrication_note_path_${fabPathId++}`,pcb_component_id,layer:"top",route,stroke_width:fp_line2.stroke.width,port_hints:[]}):lowerLayer.startsWith("user.")?circuitJson.push({type:"pcb_note_line",pcb_note_line_id:`pcb_note_line_${noteLineId++}`,pcb_component_id,x1:fp_line2.start[0],y1:-fp_line2.start[1],x2:fp_line2.end[0],y2:-fp_line2.end[1],stroke_width:fp_line2.stroke.width}):debug23("Unhandled layer for fp_line",fp_line2.layer)}if(fp_polys)for(let fp_poly of fp_polys){let route=[],pushRoutePoint=point42=>{!Number.isFinite(point42.x)||!Number.isFinite(point42.y)||route.push(point42)};for(let segment2 of fp_poly.pts){if(Array.isArray(segment2)){pushRoutePoint({x:segment2[0],y:-segment2[1]});continue}if(segment2&&typeof segment2=="object"&&"kind"in segment2){if(segment2.kind==="arc"){let start=makePoint(segment2.start),mid=makePoint(segment2.mid),end=makePoint(segment2.end),arcLength2=getArcLength2(start,mid,end),adjustedNumPoints=Math.max(2,Math.ceil(arcLength2/.1)),arcPoints=generateArcPath(start,mid,end,adjustedNumPoints).map(p4=>({x:p4.x,y:-p4.y}));for(let point42 of arcPoints)pushRoutePoint(point42)}continue}}let routePoints=route,polygonPoints=routePoints.length>2&&routePoints[0].x===routePoints[routePoints.length-1].x&&routePoints[0].y===routePoints[routePoints.length-1].y?routePoints.slice(0,-1):routePoints;if(routePoints.length===0)continue;let strokeWidth=fp_poly.stroke?.width??0;if(fp_poly.layer.endsWith(".Cu")){let rect=getAxisAlignedRectFromPoints(polygonPoints);rect?circuitJson.push({type:"pcb_smtpad",pcb_smtpad_id:`pcb_smtpad_${smtpadId++}`,shape:"rect",x:rect.x,y:rect.y,width:rect.width,height:rect.height,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),pcb_component_id}):fpPolyHasFill(fp_poly.fill)?polygonPoints.length>=3?circuitJson.push({type:"pcb_smtpad",pcb_smtpad_id:`pcb_smtpad_${smtpadId++}`,shape:"polygon",points:polygonPoints,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),pcb_component_id}):polygonPoints.length>=2&&circuitJson.push({type:"pcb_trace",pcb_trace_id:`pcb_trace_${traceId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),route:polygonPoints,thickness:strokeWidth}):polygonPoints.length>=2&&circuitJson.push({type:"pcb_trace",pcb_trace_id:`pcb_trace_${traceId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),route:polygonPoints,thickness:strokeWidth})}else fp_poly.layer.endsWith(".SilkS")?circuitJson.push({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_path_${silkPathId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),route:routePoints,stroke_width:strokeWidth}):fp_poly.layer.endsWith(".Fab")?circuitJson.push({type:"pcb_fabrication_note_path",fabrication_note_path_id:`fabrication_note_path_${fabPathId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),route:polygonPoints,stroke_width:strokeWidth,port_hints:[]}):fp_poly.layer.toLowerCase().endsWith(".crtyd")?polygonPoints.length>=3&&circuitJson.push({type:"pcb_courtyard_polygon",pcb_courtyard_polygon_id:`pcb_courtyard_polygon_${courtyardOutlineId++}`,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),pcb_component_id,points:polygonPoints}):debug23("Unhandled layer for fp_poly",fp_poly.layer)}let notePathId=0;for(let fp_arc of fp_arcs){let lowerLayer=fp_arc.layer.toLowerCase();if(lowerLayer==="edge.cuts"){debug23("Skipping Edge.Cuts fp_arc (converted to pcb_cutout)",fp_arc.layer);continue}if(lowerLayer==="f.crtyd"||lowerLayer==="b.crtyd"){debug23("Skipping CrtYd fp_arc (converted to pcb_courtyard_outline)",fp_arc.layer);continue}let start=makePoint(fp_arc.start),mid=makePoint(fp_arc.mid),end=makePoint(fp_arc.end),arcLength2=getArcLength2(start,mid,end),arcPoints=generateArcPath(start,mid,end,Math.ceil(arcLength2));if(lowerLayer.startsWith("user.")){circuitJson.push({type:"pcb_note_path",pcb_note_path_id:`pcb_note_path_${notePathId++}`,pcb_component_id,route:arcPoints.map(p4=>({x:p4.x,y:-p4.y})),stroke_width:fp_arc.stroke.width});continue}let tscircuitLayer=convertKicadLayerToTscircuitLayer(fp_arc.layer);if(!tscircuitLayer){debug23("Unable to convert layer for fp_arc",fp_arc.layer);continue}circuitJson.push({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_path_${silkPathId++}`,layer:tscircuitLayer,pcb_component_id,route:arcPoints.map(p4=>({x:p4.x,y:-p4.y})),stroke_width:fp_arc.stroke.width})}if(fp_circles)for(let fp_circle of fp_circles){let lowerLayer=fp_circle.layer.toLowerCase(),center2=makePoint(fp_circle.center),endPoint=makePoint(fp_circle.end),radius=Math.sqrt((endPoint.x-center2.x)**2+(endPoint.y-center2.y)**2),numPoints=Math.max(16,Math.ceil(2*Math.PI*radius)),circlePoints=[];for(let i3=0;i3<=numPoints;i3++){let angle=i3/numPoints*2*Math.PI;circlePoints.push({x:center2.x+radius*Math.cos(angle),y:center2.y+radius*Math.sin(angle)})}lowerLayer.startsWith("user.")?circuitJson.push({type:"pcb_note_path",pcb_note_path_id:`pcb_note_path_${notePathId++}`,pcb_component_id,route:circlePoints.map(p4=>({x:p4.x,y:-p4.y})),stroke_width:fp_circle.stroke.width}):(lowerLayer==="f.crtyd"||lowerLayer==="b.crtyd")&&circuitJson.push({type:"pcb_courtyard_circle",pcb_courtyard_circle_id:`pcb_courtyard_circle_${courtyardOutlineId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_circle.layer),center:{x:center2.x,y:-center2.y},radius})}for(let fp_text of fp_texts){let layerRef=convertKicadLayerToTscircuitLayer(fp_text.layer);fp_text.layer.endsWith(".SilkS")?circuitJson.push({type:"pcb_silkscreen_text",layer:layerRef,font:"tscircuit2024",font_size:fp_text.effects?.font?.size[0]??1,pcb_component_id,anchor_position:{x:fp_text.at[0],y:-fp_text.at[1]},anchor_alignment:"center",text:fp_text.text}):fp_text.layer.endsWith(".Fab")?circuitJson.push({type:"pcb_fabrication_note_text",layer:layerRef,font:"tscircuit2024",font_size:fp_text.effects?.font?.size[0]??1,pcb_component_id,anchor_position:{x:fp_text.at[0],y:-fp_text.at[1]},anchor_alignment:"center",text:fp_text.text}):debug23("Unhandled layer for fp_text",fp_text.layer)}let refProp=properties.find(prop=>prop.key==="Reference"),valProp=properties.find(prop=>prop.key==="Value"),propFabTexts=[refProp,valProp].filter(p4=>p4&&!!p4.val);for(let propFab of propFabTexts){let at3=propFab.attributes.at;if(!at3)continue;let isFabLayer=propFab.attributes.layer?.toLowerCase()?.endsWith(".fab"),font_size=getSilkscreenFontSizeFromFpTexts(fp_texts);circuitJson.push({type:isFabLayer?"pcb_fabrication_note_text":"pcb_silkscreen_text",layer:"top",font:"tscircuit2024",font_size,pcb_component_id,anchor_position:{x:at3[0],y:-at3[1]},anchor_alignment:"center",text:propFab.val})}return circuitJson},parseKicadModToCircuitJson=async kicadMod=>{let kicadJson=parseKicadModToKicadJson(kicadMod);return await convertKicadJsonToTsCircuitSoup(kicadJson)};var transformJsDelivrImports=code=>code.replace(/from\s*["']\/npm\//g,'from "https://cdn.jsdelivr.net/npm/').replace(/import\s*\(\s*["']\/npm\//g,'import("https://cdn.jsdelivr.net/npm/'),dynamicallyLoadDependencyWithCdnBackup=async packageName=>{try{return(await import(packageName)).default}catch{console.log(`Failed to load ${packageName} locally, trying CDN fallback...`);try{let res2=await fetch(`https://cdn.jsdelivr.net/npm/${packageName}/+esm`);if(!res2.ok)throw new Error(`Failed to fetch ${packageName} from CDN: ${res2.statusText}`);let code=await res2.text();code=transformJsDelivrImports(code);let blob=new Blob([code],{type:"application/javascript"}),url2=URL.createObjectURL(blob);try{let{default:loadedModule}=await import(url2);return loadedModule}finally{URL.revokeObjectURL(url2)}}catch(cdnError){throw console.error(`CDN fallback for ${packageName} also failed:`,cdnError),cdnError}}};var KICAD_FOOTPRINT_CACHE_URL="https://kicad-mod-cache.tscircuit.com",ngspiceEngineCache=null,getPlatformConfig=(overrides={},options={})=>{let partsEngine2=overrides.partsEngine??jlcPartsEngine;return!overrides.partsEngine&&options.easyEdaProxyConfig&&(partsEngine2=new JlcPcbPartsEngine({platformFetch:overrides.platformFetch,easyEdaProxyConfig:options.easyEdaProxyConfig})),{localCacheEngine:overrides.localCacheEngine,partsEngine:partsEngine2,spiceEngineMap:{ngspice:{simulate:async spice=>{if(!ngspiceEngineCache){let createNgspiceSpiceEngine=await dynamicallyLoadDependencyWithCdnBackup("@tscircuit/ngspice-spice-engine").catch(error2=>{throw new Error("Could not load ngspice engine from local node_modules or CDN fallback.",{cause:error2})});createNgspiceSpiceEngine&&(ngspiceEngineCache=await createNgspiceSpiceEngine())}if(!ngspiceEngineCache)throw new Error("Could not load ngspice engine from local node_modules or CDN fallback.");return ngspiceEngineCache.simulate(spice)}}},footprintLibraryMap:{kicad:async footprintName=>{let baseUrl=`${KICAD_FOOTPRINT_CACHE_URL}/${footprintName}`,circuitJsonUrl=`${baseUrl}.circuit.json`,res2=await fetch(circuitJsonUrl);if(!res2.ok){let bodyPreview=(await res2.text()).slice(0,200);throw new Error(`Failed to load KiCad footprint "${footprintName}" from ${circuitJsonUrl} (HTTP ${res2.status}). ${bodyPreview}`)}let raw;try{raw=await res2.json()}catch{throw new Error(`Failed to parse KiCad footprint JSON for "${footprintName}" from ${circuitJsonUrl}`)}let filtered=Array.isArray(raw)?raw.filter(el3=>el3?.type==="pcb_silkscreen_text"?el3?.text==="REF**":!0):[raw],wrlUrl=`${baseUrl}.wrl`,stepUrl=`${baseUrl}.step`;return{footprintCircuitJson:filtered,cadModel:{wrlUrl,stepUrl,modelUnitToMmScale:2.54}}}},footprintFileParserMap:{kicad_mod:{loadFromUrl:async url2=>{let kicadContent=await fetch(url2).then(res2=>res2.text()),kicadJson=await parseKicadModToCircuitJson(kicadContent);return{footprintCircuitJson:Array.isArray(kicadJson)?kicadJson:[kicadJson]}}}}}};var tslib_es6_exports={};__export(tslib_es6_exports,{__addDisposableResource:()=>__addDisposableResource,__assign:()=>__assign,__asyncDelegator:()=>__asyncDelegator,__asyncGenerator:()=>__asyncGenerator,__asyncValues:()=>__asyncValues,__await:()=>__await,__awaiter:()=>__awaiter,__classPrivateFieldGet:()=>__classPrivateFieldGet,__classPrivateFieldIn:()=>__classPrivateFieldIn,__classPrivateFieldSet:()=>__classPrivateFieldSet,__createBinding:()=>__createBinding,__decorate:()=>__decorate,__disposeResources:()=>__disposeResources,__esDecorate:()=>__esDecorate,__exportStar:()=>__exportStar,__extends:()=>__extends,__generator:()=>__generator,__importDefault:()=>__importDefault,__importStar:()=>__importStar,__makeTemplateObject:()=>__makeTemplateObject,__metadata:()=>__metadata,__param:()=>__param,__propKey:()=>__propKey,__read:()=>__read,__rest:()=>__rest,__rewriteRelativeImportExtension:()=>__rewriteRelativeImportExtension,__runInitializers:()=>__runInitializers,__setFunctionName:()=>__setFunctionName,__spread:()=>__spread,__spreadArray:()=>__spreadArray,__spreadArrays:()=>__spreadArrays,__values:()=>__values,default:()=>tslib_es6_default});var extendStatics=function(d4,b3){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d5,b4){d5.__proto__=b4}||function(d5,b4){for(var p4 in b4)Object.prototype.hasOwnProperty.call(b4,p4)&&(d5[p4]=b4[p4])},extendStatics(d4,b3)};function __extends(d4,b3){if(typeof b3!="function"&&b3!==null)throw new TypeError("Class extends value "+String(b3)+" is not a constructor or null");extendStatics(d4,b3);function __2(){this.constructor=d4}d4.prototype=b3===null?Object.create(b3):(__2.prototype=b3.prototype,new __2)}var __assign=function(){return __assign=Object.assign||function(t52){for(var s3,i3=1,n4=arguments.length;i3<n4;i3++){s3=arguments[i3];for(var p4 in s3)Object.prototype.hasOwnProperty.call(s3,p4)&&(t52[p4]=s3[p4])}return t52},__assign.apply(this,arguments)};function __rest(s3,e5){var t52={};for(var p4 in s3)Object.prototype.hasOwnProperty.call(s3,p4)&&e5.indexOf(p4)<0&&(t52[p4]=s3[p4]);if(s3!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i3=0,p4=Object.getOwnPropertySymbols(s3);i3<p4.length;i3++)e5.indexOf(p4[i3])<0&&Object.prototype.propertyIsEnumerable.call(s3,p4[i3])&&(t52[p4[i3]]=s3[p4[i3]]);return t52}function __decorate(decorators,target,key,desc){var c4=arguments.length,r5=c4<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d4;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r5=Reflect.decorate(decorators,target,key,desc);else for(var i3=decorators.length-1;i3>=0;i3--)(d4=decorators[i3])&&(r5=(c4<3?d4(r5):c4>3?d4(target,key,r5):d4(target,key))||r5);return c4>3&&r5&&Object.defineProperty(target,key,r5),r5}function __param(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}}function __esDecorate(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f3){if(f3!==void 0&&typeof f3!="function")throw new TypeError("Function expected");return f3}for(var kind=contextIn.kind,key=kind==="getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),_4,done=!1,i3=decorators.length-1;i3>=0;i3--){var context={};for(var p4 in contextIn)context[p4]=p4==="access"?{}:contextIn[p4];for(var p4 in contextIn.access)context.access[p4]=contextIn.access[p4];context.addInitializer=function(f3){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f3||null))};var result=(0,decorators[i3])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_4=accept(result.get))&&(descriptor.get=_4),(_4=accept(result.set))&&(descriptor.set=_4),(_4=accept(result.init))&&initializers.unshift(_4)}else(_4=accept(result))&&(kind==="field"?initializers.unshift(_4):descriptor[key]=_4)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0}function __runInitializers(thisArg,initializers,value){for(var useValue=arguments.length>2,i3=0;i3<initializers.length;i3++)value=useValue?initializers[i3].call(thisArg,value):initializers[i3].call(thisArg);return useValue?value:void 0}function __propKey(x4){return typeof x4=="symbol"?x4:"".concat(x4)}function __setFunctionName(f3,name,prefix){return typeof name=="symbol"&&(name=name.description?"[".concat(name.description,"]"):""),Object.defineProperty(f3,"name",{configurable:!0,value:prefix?"".concat(prefix," ",name):name})}function __metadata(metadataKey,metadataValue){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(metadataKey,metadataValue)}function __awaiter(thisArg,_arguments,P4,generator){function adopt(value){return value instanceof P4?value:new P4(function(resolve){resolve(value)})}return new(P4||(P4=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e5){reject(e5)}}function rejected(value){try{step(generator.throw(value))}catch(e5){reject(e5)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var _4={label:0,sent:function(){if(t52[0]&1)throw t52[1];return t52[1]},trys:[],ops:[]},f3,y4,t52,g6=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return g6.next=verb(0),g6.throw=verb(1),g6.return=verb(2),typeof Symbol=="function"&&(g6[Symbol.iterator]=function(){return this}),g6;function verb(n4){return function(v4){return step([n4,v4])}}function step(op3){if(f3)throw new TypeError("Generator is already executing.");for(;g6&&(g6=0,op3[0]&&(_4=0)),_4;)try{if(f3=1,y4&&(t52=op3[0]&2?y4.return:op3[0]?y4.throw||((t52=y4.return)&&t52.call(y4),0):y4.next)&&!(t52=t52.call(y4,op3[1])).done)return t52;switch(y4=0,t52&&(op3=[op3[0]&2,t52.value]),op3[0]){case 0:case 1:t52=op3;break;case 4:return _4.label++,{value:op3[1],done:!1};case 5:_4.label++,y4=op3[1],op3=[0];continue;case 7:op3=_4.ops.pop(),_4.trys.pop();continue;default:if(t52=_4.trys,!(t52=t52.length>0&&t52[t52.length-1])&&(op3[0]===6||op3[0]===2)){_4=0;continue}if(op3[0]===3&&(!t52||op3[1]>t52[0]&&op3[1]<t52[3])){_4.label=op3[1];break}if(op3[0]===6&&_4.label<t52[1]){_4.label=t52[1],t52=op3;break}if(t52&&_4.label<t52[2]){_4.label=t52[2],_4.ops.push(op3);break}t52[2]&&_4.ops.pop(),_4.trys.pop();continue}op3=body.call(thisArg,_4)}catch(e5){op3=[6,e5],y4=0}finally{f3=t52=0}if(op3[0]&5)throw op3[1];return{value:op3[0]?op3[1]:void 0,done:!0}}}var __createBinding=Object.create?(function(o4,m4,k4,k22){k22===void 0&&(k22=k4);var desc=Object.getOwnPropertyDescriptor(m4,k4);(!desc||("get"in desc?!m4.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m4[k4]}}),Object.defineProperty(o4,k22,desc)}):(function(o4,m4,k4,k22){k22===void 0&&(k22=k4),o4[k22]=m4[k4]});function __exportStar(m4,o4){for(var p4 in m4)p4!=="default"&&!Object.prototype.hasOwnProperty.call(o4,p4)&&__createBinding(o4,m4,p4)}function __values(o4){var s3=typeof Symbol=="function"&&Symbol.iterator,m4=s3&&o4[s3],i3=0;if(m4)return m4.call(o4);if(o4&&typeof o4.length=="number")return{next:function(){return o4&&i3>=o4.length&&(o4=void 0),{value:o4&&o4[i3++],done:!o4}}};throw new TypeError(s3?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o4,n4){var m4=typeof Symbol=="function"&&o4[Symbol.iterator];if(!m4)return o4;var i3=m4.call(o4),r5,ar3=[],e5;try{for(;(n4===void 0||n4-- >0)&&!(r5=i3.next()).done;)ar3.push(r5.value)}catch(error2){e5={error:error2}}finally{try{r5&&!r5.done&&(m4=i3.return)&&m4.call(i3)}finally{if(e5)throw e5.error}}return ar3}function __spread(){for(var ar3=[],i3=0;i3<arguments.length;i3++)ar3=ar3.concat(__read(arguments[i3]));return ar3}function __spreadArrays(){for(var s3=0,i3=0,il3=arguments.length;i3<il3;i3++)s3+=arguments[i3].length;for(var r5=Array(s3),k4=0,i3=0;i3<il3;i3++)for(var a3=arguments[i3],j4=0,jl3=a3.length;j4<jl3;j4++,k4++)r5[k4]=a3[j4];return r5}function __spreadArray(to3,from,pack2){if(pack2||arguments.length===2)for(var i3=0,l4=from.length,ar3;i3<l4;i3++)(ar3||!(i3 in from))&&(ar3||(ar3=Array.prototype.slice.call(from,0,i3)),ar3[i3]=from[i3]);return to3.concat(ar3||Array.prototype.slice.call(from))}function __await(v4){return this instanceof __await?(this.v=v4,this):new __await(v4)}function __asyncGenerator(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g6=generator.apply(thisArg,_arguments||[]),i3,q4=[];return i3=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),verb("next"),verb("throw"),verb("return",awaitReturn),i3[Symbol.asyncIterator]=function(){return this},i3;function awaitReturn(f3){return function(v4){return Promise.resolve(v4).then(f3,reject)}}function verb(n4,f3){g6[n4]&&(i3[n4]=function(v4){return new Promise(function(a3,b3){q4.push([n4,v4,a3,b3])>1||resume(n4,v4)})},f3&&(i3[n4]=f3(i3[n4])))}function resume(n4,v4){try{step(g6[n4](v4))}catch(e5){settle(q4[0][3],e5)}}function step(r5){r5.value instanceof __await?Promise.resolve(r5.value.v).then(fulfill,reject):settle(q4[0][2],r5)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f3,v4){f3(v4),q4.shift(),q4.length&&resume(q4[0][0],q4[0][1])}}function __asyncDelegator(o4){var i3,p4;return i3={},verb("next"),verb("throw",function(e5){throw e5}),verb("return"),i3[Symbol.iterator]=function(){return this},i3;function verb(n4,f3){i3[n4]=o4[n4]?function(v4){return(p4=!p4)?{value:__await(o4[n4](v4)),done:!1}:f3?f3(v4):v4}:f3}}function __asyncValues(o4){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m4=o4[Symbol.asyncIterator],i3;return m4?m4.call(o4):(o4=typeof __values=="function"?__values(o4):o4[Symbol.iterator](),i3={},verb("next"),verb("throw"),verb("return"),i3[Symbol.asyncIterator]=function(){return this},i3);function verb(n4){i3[n4]=o4[n4]&&function(v4){return new Promise(function(resolve,reject){v4=o4[n4](v4),settle(resolve,reject,v4.done,v4.value)})}}function settle(resolve,reject,d4,v4){Promise.resolve(v4).then(function(v5){resolve({value:v5,done:d4})},reject)}}function __makeTemplateObject(cooked,raw){return Object.defineProperty?Object.defineProperty(cooked,"raw",{value:raw}):cooked.raw=raw,cooked}var __setModuleDefault=Object.create?(function(o4,v4){Object.defineProperty(o4,"default",{enumerable:!0,value:v4})}):function(o4,v4){o4.default=v4},ownKeys=function(o4){return ownKeys=Object.getOwnPropertyNames||function(o6){var ar3=[];for(var k4 in o6)Object.prototype.hasOwnProperty.call(o6,k4)&&(ar3[ar3.length]=k4);return ar3},ownKeys(o4)};function __importStar(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k4=ownKeys(mod),i3=0;i3<k4.length;i3++)k4[i3]!=="default"&&__createBinding(result,mod,k4[i3]);return __setModuleDefault(result,mod),result}function __importDefault(mod){return mod&&mod.__esModule?mod:{default:mod}}function __classPrivateFieldGet(receiver,state2,kind,f3){if(kind==="a"&&!f3)throw new TypeError("Private accessor was defined without a getter");if(typeof state2=="function"?receiver!==state2||!f3:!state2.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f3:kind==="a"?f3.call(receiver):f3?f3.value:state2.get(receiver)}function __classPrivateFieldSet(receiver,state2,value,kind,f3){if(kind==="m")throw new TypeError("Private method is not writable");if(kind==="a"&&!f3)throw new TypeError("Private accessor was defined without a setter");if(typeof state2=="function"?receiver!==state2||!f3:!state2.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return kind==="a"?f3.call(receiver,value):f3?f3.value=value:state2.set(receiver,value),value}function __classPrivateFieldIn(state2,receiver){if(receiver===null||typeof receiver!="object"&&typeof receiver!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof state2=="function"?receiver===state2:state2.has(receiver)}function __addDisposableResource(env,value,async){if(value!=null){if(typeof value!="object"&&typeof value!="function")throw new TypeError("Object expected.");var dispose,inner;if(async){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");dispose=value[Symbol.asyncDispose]}if(dispose===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");dispose=value[Symbol.dispose],async&&(inner=dispose)}if(typeof dispose!="function")throw new TypeError("Object not disposable.");inner&&(dispose=function(){try{inner.call(this)}catch(e5){return Promise.reject(e5)}}),env.stack.push({value,dispose,async})}else async&&env.stack.push({async:!0});return value}var _SuppressedError=typeof SuppressedError=="function"?SuppressedError:function(error2,suppressed,message){var e5=new Error(message);return e5.name="SuppressedError",e5.error=error2,e5.suppressed=suppressed,e5};function __disposeResources(env){function fail(e5){env.error=env.hasError?new _SuppressedError(e5,env.error,"An error was suppressed during disposal."):e5,env.hasError=!0}var r5,s3=0;function next2(){for(;r5=env.stack.pop();)try{if(!r5.async&&s3===1)return s3=0,env.stack.push(r5),Promise.resolve().then(next2);if(r5.dispose){var result=r5.dispose.call(r5.value);if(r5.async)return s3|=2,Promise.resolve(result).then(next2,function(e5){return fail(e5),next2()})}else s3|=1}catch(e5){fail(e5)}if(s3===1)return env.hasError?Promise.reject(env.error):Promise.resolve();if(env.hasError)throw env.error}return next2()}function __rewriteRelativeImportExtension(path,preserveJsx){return typeof path=="string"&&/^\.\.?\//.test(path)?path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(m4,tsx,d4,ext,cm3){return tsx?preserveJsx?".jsx":".js":d4&&(!ext||!cm3)?m4:d4+ext+"."+cm3.toLowerCase()+"js"}):path}var tslib_es6_default={__extends,__assign,__rest,__decorate,__param,__esDecorate,__runInitializers,__propKey,__setFunctionName,__metadata,__awaiter,__generator,__createBinding,__exportStar,__values,__read,__spread,__spreadArrays,__spreadArray,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault,__classPrivateFieldGet,__classPrivateFieldSet,__classPrivateFieldIn,__addDisposableResource,__disposeResources,__rewriteRelativeImportExtension};var import_debug22=__toESM(require_browser(),1),debug12=(0,import_debug22.default)("tsci:eval:execution-context");function createExecutionContext(webWorkerConfiguration,opts={}){globalThis.React=React;let basePlatform=opts.platform||getPlatformConfig({},{easyEdaProxyConfig:webWorkerConfiguration.easyEdaProxyConfig}),platform=opts.projectConfig?{...basePlatform,...opts.projectConfig}:basePlatform;platform.partsEngineDisabled&&(platform.partsEngine=void 0);let circuit=new RootCircuit({platform});opts.name&&(circuit.name=opts.name),opts.debugNamespace&&circuit.enableDebug(opts.debugNamespace);let logs=[];return{fsMap:{},entrypoint:"",logger:{info:message=>{logs.push({msg:message})},getLogs:()=>logs,stringifyLogs:()=>logs.map(log=>log.msg).join(`
|
|
709
|
+
at `+loc}return str};peg$SyntaxError3.buildMessage=function(expected,found){var DESCRIBE_EXPECTATION_FNS={literal:function(expectation){return'"'+literalEscape(expectation.text)+'"'},class:function(expectation){var escapedParts=expectation.parts.map(function(part){return Array.isArray(part)?classEscape(part[0])+"-"+classEscape(part[1]):classEscape(part)});return"["+(expectation.inverted?"^":"")+escapedParts.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(expectation){return expectation.description}};function hex(ch3){return ch3.charCodeAt(0).toString(16).toUpperCase()}function literalEscape(s3){return s3.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch3){return"\\x0"+hex(ch3)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch3){return"\\x"+hex(ch3)})}function classEscape(s3){return s3.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(ch3){return"\\x0"+hex(ch3)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(ch3){return"\\x"+hex(ch3)})}function describeExpectation(expectation){return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation)}function describeExpected(expected2){var descriptions=expected2.map(describeExpectation),i3,j4;if(descriptions.sort(),descriptions.length>0){for(i3=1,j4=1;i3<descriptions.length;i3++)descriptions[i3-1]!==descriptions[i3]&&(descriptions[j4]=descriptions[i3],j4++);descriptions.length=j4}switch(descriptions.length){case 1:return descriptions[0];case 2:return descriptions[0]+" or "+descriptions[1];default:return descriptions.slice(0,-1).join(", ")+", or "+descriptions[descriptions.length-1]}}function describeFound(found2){return found2?'"'+literalEscape(found2)+'"':"end of input"}return"Expected "+describeExpected(expected)+" but "+describeFound(found)+" found."};function decomposeTSR3(matrix2,flipX=!1,flipY2=!1){flipX?flipY2?matrix2=compose4(matrix2,scale4(-1,-1)):matrix2=compose4(matrix2,scale4(1,-1)):flipY2&&(matrix2=compose4(matrix2,scale4(-1,1)));let a3=matrix2.a,b3=matrix2.b,c4=matrix2.c,d4=matrix2.d,scaleX,scaleY,rotation22;if(a3!==0||c4!==0){let hypotAc=Math.hypot(a3,c4);scaleX=hypotAc,scaleY=(a3*d4-b3*c4)/hypotAc;let acos=Math.acos(a3/hypotAc);rotation22=c4>0?-acos:acos}else if(b3!==0||d4!==0){let hypotBd=Math.hypot(b3,d4);scaleX=(a3*d4-b3*c4)/hypotBd,scaleY=hypotBd;let acos=Math.acos(b3/hypotBd);rotation22=Math.PI/2+(d4>0?-acos:acos)}else scaleX=0,scaleY=0,rotation22=0;return flipY2&&(scaleX=-scaleX),flipX&&(scaleY=-scaleY),{translate:{tx:matrix2.e,ty:matrix2.f},scale:{sx:scaleX,sy:scaleY},rotation:{angle:rotation22}}}function connect2(map,a3,b3){if(!a3||!b3)return;let setA=map.get(a3);setA||(setA=new Set,map.set(a3,setA)),setA.add(b3);let setB=map.get(b3);setB||(setB=new Set,map.set(b3,setB)),setB.add(a3)}function buildSubtree2(soup,opts){if(!opts.subcircuit_id&&!opts.source_group_id)return[...soup];let effectiveOpts=opts;if(opts.subcircuit_id){let subcircuitIds=new Set([opts.subcircuit_id]),groupChildren=new Map,groupSubcircuit=new Map;for(let elm of soup)if(elm.type==="source_group"){let groupId=elm.source_group_id,subcircuitId=elm.subcircuit_id;subcircuitId&&groupSubcircuit.set(groupId,subcircuitId);let parentId=elm.parent_source_group_id;parentId&&(groupChildren.has(parentId)||groupChildren.set(parentId,[]),groupChildren.get(parentId).push(groupId))}let rootGroupId;for(let[groupId,subcircuitId]of groupSubcircuit)if(subcircuitId===opts.subcircuit_id){rootGroupId=groupId;break}if(rootGroupId){let collectChildSubcircuits=groupId=>{let children=groupChildren.get(groupId)||[];for(let childId of children){let childSubcircuit=groupSubcircuit.get(childId);childSubcircuit&&subcircuitIds.add(childSubcircuit),collectChildSubcircuits(childId)}};collectChildSubcircuits(rootGroupId),effectiveOpts={...opts,subcircuit_ids:Array.from(subcircuitIds)}}}let idMap=new Map;for(let elm of soup){let idKey=`${elm.type}_id`,idVal=elm[idKey];typeof idVal=="string"&&idMap.set(idVal,elm)}let adj=new Map;for(let elm of soup){let entries=Object.entries(elm);for(let[key,val]of entries)if(key!=="parent_source_group_id"){if(key.endsWith("_id")&&typeof val=="string"){let other=idMap.get(val);connect2(adj,elm,other)}else if(key.endsWith("_ids")&&Array.isArray(val)){for(let v4 of val)if(typeof v4=="string"){let other=idMap.get(v4);connect2(adj,elm,other)}}}}let queue=[],included=new Set;for(let elm of soup){let shouldInclude=!1;(effectiveOpts.subcircuit_id&&"subcircuit_id"in elm&&elm.subcircuit_id===effectiveOpts.subcircuit_id||effectiveOpts.subcircuit_ids&&"subcircuit_id"in elm&&elm.subcircuit_id&&effectiveOpts.subcircuit_ids.includes(elm.subcircuit_id)||effectiveOpts.source_group_id&&"source_group_id"in elm&&elm.source_group_id===effectiveOpts.source_group_id||effectiveOpts.source_group_id&&"member_source_group_ids"in elm&&Array.isArray(elm.member_source_group_ids)&&elm.member_source_group_ids.includes(effectiveOpts.source_group_id))&&(shouldInclude=!0),shouldInclude&&(queue.push(elm),included.add(elm))}for(;queue.length>0;){let elm=queue.shift(),neighbors=adj.get(elm);if(neighbors)for(let n4 of neighbors)included.has(n4)||(included.add(n4),queue.push(n4))}return soup.filter(e5=>included.has(e5))}var cju2=(circuitJsonInput,options={})=>{let circuitJson=circuitJsonInput,internalStore=circuitJson._internal_store;if(!internalStore){internalStore={counts:{},editCount:0},circuitJson._internal_store=internalStore;for(let elm of circuitJson){let type=elm.type,idVal=elm[`${type}_id`];if(!idVal)continue;let idNum=Number.parseInt(idVal.split("_").pop());Number.isNaN(idNum)||(internalStore.counts[type]=Math.max(internalStore.counts[type]??0,idNum))}}let su22=new Proxy({},{get:(proxy_target,prop)=>{if(prop==="toArray")return()=>(circuitJson.editCount=internalStore.editCount,circuitJson);if(prop==="editCount")return internalStore.editCount;if(prop==="subtree")return opts=>cju2(buildSubtree2(circuitJson,opts),options);if(prop==="insert")return elm=>{var _a415;let component_type2=elm.type;if(!component_type2)throw new Error("insert requires an element with a type");(_a415=internalStore.counts)[component_type2]??(_a415[component_type2]=-1),internalStore.counts[component_type2]++;let index=internalStore.counts[component_type2],newElm={...elm,type:component_type2,[`${component_type2}_id`]:`${component_type2}_${index}`};return options.validateInserts&&(dist_exports6[component_type2]??any_soup_element2).parse(newElm),circuitJson.push(newElm),internalStore.editCount++,newElm};if(prop==="insertAll")return elms=>elms.map(elm=>su22.insert(elm));let component_type=prop;return{get:id2=>circuitJson.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===id2),getUsing:using=>{let keys=Object.keys(using);if(keys.length!==1)throw new Error("getUsing requires exactly one key, e.g. { pcb_component_id }");let join_key=keys[0],join_type=join_key.replace("_id",""),joiner=circuitJson.find(e5=>e5.type===join_type&&e5[join_key]===using[join_key]);return joiner?circuitJson.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===joiner[`${component_type}_id`]):null},getWhere:where=>{let keys=Object.keys(where);return circuitJson.find(e5=>e5.type===component_type&&keys.every(key=>e5[key]===where[key]))},list:where=>{let keys=where?Object.keys(where):[];return circuitJson.filter(e5=>e5.type===component_type&&keys.every(key=>e5[key]===where[key]))},insert:elm=>{var _a415;(_a415=internalStore.counts)[component_type]??(_a415[component_type]=-1),internalStore.counts[component_type]++;let index=internalStore.counts[component_type],newElm={type:component_type,[`${component_type}_id`]:`${component_type}_${index}`,...elm};return options.validateInserts&&(dist_exports6[component_type]??any_soup_element2).parse(newElm),circuitJson.push(newElm),internalStore.editCount++,newElm},delete:id2=>{let elm=circuitJson.find(e5=>e5[`${component_type}_id`]===id2);elm&&(circuitJson.splice(circuitJson.indexOf(elm),1),internalStore.editCount++)},update:(id2,newProps)=>{let elm=circuitJson.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===id2);return elm?(Object.assign(elm,newProps),internalStore.editCount++,elm):null},select:selector=>{if(component_type==="source_component")return circuitJson.find(e5=>e5.type==="source_component"&&e5.name===selector.replace(/\./g,""));if(component_type==="pcb_port"||component_type==="source_port"||component_type==="schematic_port"){let[component_name,port_selector]=selector.replace(/\./g,"").split(/[\s\>]+/),source_component=circuitJson.find(e5=>e5.type==="source_component"&&e5.name===component_name);if(!source_component)return null;let source_port22=circuitJson.find(e5=>e5.type==="source_port"&&e5.source_component_id===source_component.source_component_id&&(e5.name===port_selector||(e5.port_hints??[]).includes(port_selector)));if(!source_port22)return null;if(component_type==="source_port")return source_port22;if(component_type==="pcb_port")return circuitJson.find(e5=>e5.type==="pcb_port"&&e5.source_port_id===source_port22.source_port_id);if(component_type==="schematic_port")return circuitJson.find(e5=>e5.type==="schematic_port"&&e5.source_port_id===source_port22.source_port_id)}}}}});return su22};cju2.unparsed=cju2;function createIdKey2(element){let type=element.type;return`${type}:${element[`${type}_id`]}`}var cjuIndexed2=(soup,options={})=>{let internalStore=soup._internal_store_indexed;if(!internalStore){internalStore={counts:{},editCount:0,indexes:{}};for(let elm of soup){let type=elm.type,idVal=elm[`${type}_id`];if(!idVal)continue;let idNum=Number.parseInt(idVal.split("_").pop()||"");Number.isNaN(idNum)||(internalStore.counts[type]=Math.max(internalStore.counts[type]??0,idNum))}let indexConfig=options.indexConfig||{},indexes=internalStore.indexes;if(indexConfig.byId&&(indexes.byId=new Map),indexConfig.byType&&(indexes.byType=new Map),indexConfig.byRelation&&(indexes.byRelation=new Map),indexConfig.bySubcircuit&&(indexes.bySubcircuit=new Map),indexConfig.byCustomField&&indexConfig.byCustomField.length>0){indexes.byCustomField=new Map;for(let field of indexConfig.byCustomField)indexes.byCustomField.set(field,new Map)}for(let element of soup){if(indexConfig.byId){let idKey=createIdKey2(element);indexes.byId.set(idKey,element)}if(indexConfig.byType){let elementsOfType=indexes.byType.get(element.type)||[];elementsOfType.push(element),indexes.byType.set(element.type,elementsOfType)}if(indexConfig.byRelation){let elementEntries=Object.entries(element);for(let[key,value]of elementEntries)if(key.endsWith("_id")&&key!==`${element.type}_id`&&typeof value=="string"){let relationTypeMap=indexes.byRelation.get(key)||new Map,relatedElements=relationTypeMap.get(value)||[];relatedElements.push(element),relationTypeMap.set(value,relatedElements),indexes.byRelation.set(key,relationTypeMap)}}if(indexConfig.bySubcircuit&&"subcircuit_id"in element){let subcircuitId=element.subcircuit_id;if(subcircuitId&&typeof subcircuitId=="string"){let subcircuitElements=indexes.bySubcircuit.get(subcircuitId)||[];subcircuitElements.push(element),indexes.bySubcircuit.set(subcircuitId,subcircuitElements)}}if(indexConfig.byCustomField&&indexes.byCustomField){for(let field of indexConfig.byCustomField)if(field in element){let fieldValue=element[field];if(fieldValue!==void 0&&(typeof fieldValue=="string"||typeof fieldValue=="number")){let fieldValueStr=String(fieldValue),fieldMap=indexes.byCustomField.get(field),elementsWithFieldValue=fieldMap.get(fieldValueStr)||[];elementsWithFieldValue.push(element),fieldMap.set(fieldValueStr,elementsWithFieldValue)}}}}soup._internal_store_indexed=internalStore}return new Proxy({},{get:(proxy_target,prop)=>{if(prop==="toArray")return()=>(soup.editCount=internalStore.editCount,soup);if(prop==="editCount")return internalStore.editCount;let component_type=prop;return{get:id2=>{let indexConfig=options.indexConfig||{};return indexConfig.byId&&internalStore.indexes.byId?internalStore.indexes.byId.get(`${component_type}:${id2}`)||null:indexConfig.byType&&internalStore.indexes.byType?(internalStore.indexes.byType.get(component_type)||[]).find(e5=>e5[`${component_type}_id`]===id2)||null:soup.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===id2)||null},getUsing:using=>{let indexConfig=options.indexConfig||{},keys=Object.keys(using);if(keys.length!==1)throw new Error("getUsing requires exactly one key, e.g. { pcb_component_id }");let join_key=keys[0],join_type=join_key.replace("_id","");if(indexConfig.byRelation&&internalStore.indexes.byRelation){let relationMap=internalStore.indexes.byRelation.get(join_key);if(relationMap){let joiner2=(relationMap.get(using[join_key])||[]).find(e5=>e5.type===join_type);if(!joiner2)return null;let joinerId=joiner2[`${component_type}_id`];return indexConfig.byId&&internalStore.indexes.byId?internalStore.indexes.byId.get(`${component_type}:${joinerId}`)||null:indexConfig.byType&&internalStore.indexes.byType?(internalStore.indexes.byType.get(component_type)||[]).find(e5=>e5[`${component_type}_id`]===joinerId)||null:soup.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===joinerId)||null}}let joiner=soup.find(e5=>e5.type===join_type&&e5[join_key]===using[join_key]);return joiner&&soup.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===joiner[`${component_type}_id`])||null},getWhere:where=>{let indexConfig=options.indexConfig||{},keys=Object.keys(where);if(keys.length===1&&indexConfig.byCustomField&&internalStore.indexes.byCustomField){let field=keys[0],fieldMap=internalStore.indexes.byCustomField.get(field);if(fieldMap){let fieldValue=String(where[field]);return(fieldMap.get(fieldValue)||[]).find(e5=>e5.type===component_type)||null}}if("subcircuit_id"in where&&indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit){let subcircuitId=where.subcircuit_id;return(internalStore.indexes.bySubcircuit.get(subcircuitId)||[]).find(e5=>e5.type===component_type&&keys.every(key=>e5[key]===where[key]))||null}return indexConfig.byType&&internalStore.indexes.byType?(internalStore.indexes.byType.get(component_type)||[]).find(e5=>keys.every(key=>e5[key]===where[key]))||null:soup.find(e5=>e5.type===component_type&&keys.every(key=>e5[key]===where[key]))||null},list:where=>{let indexConfig=options.indexConfig||{},keys=where?Object.keys(where):[];if(keys.length===0&&indexConfig.byType&&internalStore.indexes.byType)return internalStore.indexes.byType.get(component_type)||[];if(keys.length===1&&keys[0]==="subcircuit_id"&&indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit){let subcircuitId=where.subcircuit_id;return(internalStore.indexes.bySubcircuit.get(subcircuitId)||[]).filter(e5=>e5.type===component_type)}let elementsToFilter;return indexConfig.byType&&internalStore.indexes.byType?elementsToFilter=internalStore.indexes.byType.get(component_type)||[]:elementsToFilter=soup.filter(e5=>e5.type===component_type),keys.length>0?elementsToFilter.filter(e5=>keys.every(key=>e5[key]===where[key])):elementsToFilter},insert:elm=>{var _a415;(_a415=internalStore.counts)[component_type]??(_a415[component_type]=-1),internalStore.counts[component_type]++;let index=internalStore.counts[component_type],newElm={type:component_type,[`${component_type}_id`]:`${component_type}_${index}`,...elm};options.validateInserts&&(dist_exports6[component_type]??any_soup_element2).parse(newElm),soup.push(newElm),internalStore.editCount++;let indexConfig=options.indexConfig||{};if(indexConfig.byId&&internalStore.indexes.byId){let idKey=createIdKey2(newElm);internalStore.indexes.byId.set(idKey,newElm)}if(indexConfig.byType&&internalStore.indexes.byType){let elementsOfType=internalStore.indexes.byType.get(component_type)||[];elementsOfType.push(newElm),internalStore.indexes.byType.set(component_type,elementsOfType)}if(indexConfig.byRelation&&internalStore.indexes.byRelation){let elementEntries=Object.entries(newElm);for(let[key,value]of elementEntries)if(key.endsWith("_id")&&key!==`${newElm.type}_id`&&typeof value=="string"){let relationTypeMap=internalStore.indexes.byRelation.get(key)||new Map,relatedElements=relationTypeMap.get(value)||[];relatedElements.push(newElm),relationTypeMap.set(value,relatedElements),internalStore.indexes.byRelation.set(key,relationTypeMap)}}if(indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit&&"subcircuit_id"in newElm){let subcircuitId=newElm.subcircuit_id;if(subcircuitId&&typeof subcircuitId=="string"){let subcircuitElements=internalStore.indexes.bySubcircuit.get(subcircuitId)||[];subcircuitElements.push(newElm),internalStore.indexes.bySubcircuit.set(subcircuitId,subcircuitElements)}}if(indexConfig.byCustomField&&internalStore.indexes.byCustomField){for(let field of indexConfig.byCustomField)if(field in newElm){let fieldValue=newElm[field];if(fieldValue!==void 0&&(typeof fieldValue=="string"||typeof fieldValue=="number")){let fieldValueStr=String(fieldValue),fieldMap=internalStore.indexes.byCustomField.get(field),elementsWithFieldValue=fieldMap.get(fieldValueStr)||[];elementsWithFieldValue.push(newElm),fieldMap.set(fieldValueStr,elementsWithFieldValue)}}}return newElm},delete:id2=>{let indexConfig=options.indexConfig||{},elm;if(indexConfig.byId&&internalStore.indexes.byId?elm=internalStore.indexes.byId.get(`${component_type}:${id2}`):indexConfig.byType&&internalStore.indexes.byType?elm=(internalStore.indexes.byType.get(component_type)||[]).find(e5=>e5[`${component_type}_id`]===id2):elm=soup.find(e5=>e5[`${component_type}_id`]===id2),!elm)return;let elmIndex=soup.indexOf(elm);if(elmIndex>=0&&(soup.splice(elmIndex,1),internalStore.editCount++),indexConfig.byId&&internalStore.indexes.byId){let idKey=createIdKey2(elm);internalStore.indexes.byId.delete(idKey)}if(indexConfig.byType&&internalStore.indexes.byType){let filteredElements=(internalStore.indexes.byType.get(component_type)||[]).filter(e5=>e5[`${component_type}_id`]!==id2);internalStore.indexes.byType.set(component_type,filteredElements)}if(indexConfig.byRelation&&internalStore.indexes.byRelation)for(let[relationKey,relationMap]of internalStore.indexes.byRelation.entries())for(let[relationValue,elements]of relationMap.entries()){let updatedElements=elements.filter(e5=>e5!==elm);updatedElements.length===0?relationMap.delete(relationValue):relationMap.set(relationValue,updatedElements)}if(indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit&&"subcircuit_id"in elm){let subcircuitId=elm.subcircuit_id;if(subcircuitId){let updatedElements=(internalStore.indexes.bySubcircuit.get(subcircuitId)||[]).filter(e5=>e5!==elm);updatedElements.length===0?internalStore.indexes.bySubcircuit.delete(subcircuitId):internalStore.indexes.bySubcircuit.set(subcircuitId,updatedElements)}}if(indexConfig.byCustomField&&internalStore.indexes.byCustomField)for(let fieldMap of internalStore.indexes.byCustomField.values())for(let[fieldValue,elements]of fieldMap.entries()){let updatedElements=elements.filter(e5=>e5!==elm);updatedElements.length===0?fieldMap.delete(fieldValue):fieldMap.set(fieldValue,updatedElements)}},update:(id2,newProps)=>{let indexConfig=options.indexConfig||{},elm;if(indexConfig.byId&&internalStore.indexes.byId?elm=internalStore.indexes.byId.get(`${component_type}:${id2}`):indexConfig.byType&&internalStore.indexes.byType?elm=(internalStore.indexes.byType.get(component_type)||[]).find(e5=>e5[`${component_type}_id`]===id2):elm=soup.find(e5=>e5.type===component_type&&e5[`${component_type}_id`]===id2),!elm)return null;if(indexConfig.byRelation&&internalStore.indexes.byRelation){let elementEntries=Object.entries(elm);for(let[key,value]of elementEntries)if(key.endsWith("_id")&&key!==`${elm.type}_id`&&typeof value=="string"&&key in newProps&&newProps[key]!==value){let relationTypeMap=internalStore.indexes.byRelation.get(key);if(relationTypeMap){let updatedElements=(relationTypeMap.get(value)||[]).filter(e5=>e5!==elm);updatedElements.length===0?relationTypeMap.delete(value):relationTypeMap.set(value,updatedElements)}}}if(indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit&&"subcircuit_id"in elm&&"subcircuit_id"in newProps){let oldSubcircuitId=elm.subcircuit_id,newSubcircuitId=newProps.subcircuit_id;if(oldSubcircuitId!==newSubcircuitId){let updatedElements=(internalStore.indexes.bySubcircuit.get(oldSubcircuitId)||[]).filter(e5=>e5!==elm);updatedElements.length===0?internalStore.indexes.bySubcircuit.delete(oldSubcircuitId):internalStore.indexes.bySubcircuit.set(oldSubcircuitId,updatedElements)}}if(indexConfig.byCustomField&&internalStore.indexes.byCustomField){for(let field of indexConfig.byCustomField)if(field in elm&&field in newProps&&elm[field]!==newProps[field]){let fieldMap=internalStore.indexes.byCustomField.get(field);if(fieldMap){let oldValue=String(elm[field]),updatedElements=(fieldMap.get(oldValue)||[]).filter(e5=>e5!==elm);updatedElements.length===0?fieldMap.delete(oldValue):fieldMap.set(oldValue,updatedElements)}}}if(Object.assign(elm,newProps),internalStore.editCount++,indexConfig.byRelation&&internalStore.indexes.byRelation){let elementEntries=Object.entries(elm);for(let[key,value]of elementEntries)if(key.endsWith("_id")&&key!==`${elm.type}_id`&&typeof value=="string"&&key in newProps){let relationTypeMap=internalStore.indexes.byRelation.get(key)||new Map,relatedElements=relationTypeMap.get(value)||[];relatedElements.includes(elm)||(relatedElements.push(elm),relationTypeMap.set(value,relatedElements),internalStore.indexes.byRelation.set(key,relationTypeMap))}}if(indexConfig.bySubcircuit&&internalStore.indexes.bySubcircuit&&"subcircuit_id"in elm&&"subcircuit_id"in newProps){let subcircuitId=elm.subcircuit_id;if(subcircuitId&&typeof subcircuitId=="string"){let subcircuitElements=internalStore.indexes.bySubcircuit.get(subcircuitId)||[];subcircuitElements.includes(elm)||(subcircuitElements.push(elm),internalStore.indexes.bySubcircuit.set(subcircuitId,subcircuitElements))}}if(indexConfig.byCustomField&&internalStore.indexes.byCustomField){for(let field of indexConfig.byCustomField)if(field in elm&&field in newProps){let fieldValue=elm[field];if(fieldValue!==void 0&&(typeof fieldValue=="string"||typeof fieldValue=="number")){let fieldValueStr=String(fieldValue),fieldMap=internalStore.indexes.byCustomField.get(field),elementsWithFieldValue=fieldMap.get(fieldValueStr)||[];elementsWithFieldValue.includes(elm)||(elementsWithFieldValue.push(elm),fieldMap.set(fieldValueStr,elementsWithFieldValue))}}}return elm},select:selector=>{if(component_type==="source_component")return soup.find(e5=>e5.type==="source_component"&&e5.name===selector.replace(/\./g,""))||null;if(component_type==="pcb_port"||component_type==="source_port"||component_type==="schematic_port"){let[component_name,port_selector]=selector.replace(/\./g,"").split(/[\s\>]+/),source_component=soup.find(e5=>e5.type==="source_component"&&e5.name===component_name);if(!source_component)return null;let source_port22=soup.find(e5=>e5.type==="source_port"&&e5.source_component_id===source_component.source_component_id&&(e5.name===port_selector||(e5.port_hints??[]).includes(port_selector)));if(!source_port22)return null;if(component_type==="source_port")return source_port22;if(component_type==="pcb_port")return soup.find(e5=>e5.type==="pcb_port"&&e5.source_port_id===source_port22.source_port_id)||null;if(component_type==="schematic_port")return soup.find(e5=>e5.type==="schematic_port"&&e5.source_port_id===source_port22.source_port_id)||null}return null}}}})};cjuIndexed2.unparsed=cjuIndexed2;var transformPCBElement2=(elm,matrix2)=>{let tsr=decomposeTSR3(matrix2),flipPadWidthHeight=Math.round(tsr.rotation.angle/(Math.PI/2))%2===1;if(elm.type==="pcb_plated_hole"||elm.type==="pcb_hole"||elm.type==="pcb_via"||elm.type==="pcb_smtpad"||elm.type==="pcb_port"){let{x:x4,y:y4}=applyToPoint4(matrix2,{x:Number(elm.x),y:Number(elm.y)});elm.x=x4,elm.y=y4,elm.type==="pcb_smtpad"&&elm.shape==="polygon"&&Array.isArray(elm.points)&&(elm.points=elm.points.map(point23=>{let tp3=applyToPoint4(matrix2,{x:point23.x,y:point23.y});return{x:tp3.x,y:tp3.y}}))}else if(elm.type==="pcb_keepout"||elm.type==="pcb_board")elm.center=applyToPoint4(matrix2,elm.center);else if(elm.type==="pcb_silkscreen_text"||elm.type==="pcb_fabrication_note_text"||elm.type==="pcb_note_text")elm.anchor_position=applyToPoint4(matrix2,elm.anchor_position);else if(elm.type==="pcb_silkscreen_circle"||elm.type==="pcb_silkscreen_rect"||elm.type==="pcb_note_rect"||elm.type==="pcb_courtyard_rect"||elm.type==="pcb_courtyard_circle")elm.center=applyToPoint4(matrix2,elm.center);else if(elm.type==="pcb_component")elm.center=applyToPoint4(matrix2,elm.center),elm.rotation=elm.rotation+tsr.rotation.angle/Math.PI*180,elm.rotation=elm.rotation%360,flipPadWidthHeight&&([elm.width,elm.height]=[elm.height,elm.width]);else if(elm.type==="pcb_courtyard_outline")elm.outline=elm.outline.map(p4=>{let tp3=applyToPoint4(matrix2,p4);return p4.x=tp3.x,p4.y=tp3.y,p4});else if(elm.type==="pcb_courtyard_polygon")elm.points=elm.points.map(p4=>{let tp3=applyToPoint4(matrix2,p4);return p4.x=tp3.x,p4.y=tp3.y,p4});else if(elm.type==="pcb_silkscreen_path"||elm.type==="pcb_trace"||elm.type==="pcb_fabrication_note_path"||elm.type==="pcb_note_path")elm.route=elm.route.map(rp3=>{let tp3=applyToPoint4(matrix2,rp3);return rp3.x=tp3.x,rp3.y=tp3.y,rp3});else if(elm.type==="pcb_silkscreen_line"||elm.type==="pcb_note_line"){let p12={x:elm.x1,y:elm.y1},p22={x:elm.x2,y:elm.y2},p1t=applyToPoint4(matrix2,p12),p2t=applyToPoint4(matrix2,p22);elm.x1=p1t.x,elm.y1=p1t.y,elm.x2=p2t.x,elm.y2=p2t.y}else if(elm.type==="cad_component"){let newPos=applyToPoint4(matrix2,{x:elm.position.x,y:elm.position.y});elm.position.x=newPos.x,elm.position.y=newPos.y}return elm},transformPCBElements2=(elms,matrix2)=>{let tsr=decomposeTSR3(matrix2),quarterTurns=Math.round(tsr.rotation.angle/(Math.PI/2)),flipPadWidthHeight=Math.abs(quarterTurns)%2===1,transformedElms=elms.map(elm=>transformPCBElement2(elm,matrix2));return flipPadWidthHeight&&(transformedElms=transformedElms.map(elm=>(elm.type==="pcb_smtpad"&&elm.shape==="rect"&&([elm.width,elm.height]=[elm.height,elm.width]),elm))),transformedElms};function stringHash3(str){let hash=0;if(str.length==0)return hash;for(var i3=0;i3<str.length;i3++){var char=str.charCodeAt(i3);hash=(hash<<5)-hash+char,hash=hash&hash}return Math.abs(hash)}var nice_color_palettes2=[["#69d2e7","#a7dbd8","#e0e4cc","#f38630","#fa6900"],["#fe4365","#fc9d9a","#f9cdad","#c8c8a9","#83af9b"],["#ecd078","#d95b43","#c02942","#542437","#53777a"],["#556270","#4ecdc4","#c7f464","#ff6b6b","#c44d58"],["#774f38","#e08e79","#f1d4af","#ece5ce","#c5e0dc"],["#e8ddcb","#cdb380","#036564","#033649","#031634"],["#490a3d","#bd1550","#e97f02","#f8ca00","#8a9b0f"],["#594f4f","#547980","#45ada8","#9de0ad","#e5fcc2"],["#00a0b0","#6a4a3c","#cc333f","#eb6841","#edc951"],["#e94e77","#d68189","#c6a49a","#c6e5d9","#f4ead5"],["#3fb8af","#7fc7af","#dad8a7","#ff9e9d","#ff3d7f"],["#d9ceb2","#948c75","#d5ded9","#7a6a53","#99b2b7"],["#ffffff","#cbe86b","#f2e9e1","#1c140d","#cbe86b"],["#efffcd","#dce9be","#555152","#2e2633","#99173c"],["#343838","#005f6b","#008c9e","#00b4cc","#00dffc"],["#413e4a","#73626e","#b38184","#f0b49e","#f7e4be"],["#ff4e50","#fc913a","#f9d423","#ede574","#e1f5c4"],["#99b898","#fecea8","#ff847c","#e84a5f","#2a363b"],["#655643","#80bca3","#f6f7bd","#e6ac27","#bf4d28"],["#00a8c6","#40c0cb","#f9f2e7","#aee239","#8fbe00"],["#351330","#424254","#64908a","#e8caa4","#cc2a41"],["#554236","#f77825","#d3ce3d","#f1efa5","#60b99a"],["#5d4157","#838689","#a8caba","#cad7b2","#ebe3aa"],["#8c2318","#5e8c6a","#88a65e","#bfb35a","#f2c45a"],["#fad089","#ff9c5b","#f5634a","#ed303c","#3b8183"],["#ff4242","#f4fad2","#d4ee5e","#e1edb9","#f0f2eb"],["#f8b195","#f67280","#c06c84","#6c5b7b","#355c7d"],["#d1e751","#ffffff","#000000","#4dbce9","#26ade4"],["#1b676b","#519548","#88c425","#bef202","#eafde6"],["#5e412f","#fcebb6","#78c0a8","#f07818","#f0a830"],["#bcbdac","#cfbe27","#f27435","#f02475","#3b2d38"],["#452632","#91204d","#e4844a","#e8bf56","#e2f7ce"],["#eee6ab","#c5bc8e","#696758","#45484b","#36393b"],["#f0d8a8","#3d1c00","#86b8b1","#f2d694","#fa2a00"],["#2a044a","#0b2e59","#0d6759","#7ab317","#a0c55f"],["#f04155","#ff823a","#f2f26f","#fff7bd","#95cfb7"],["#b9d7d9","#668284","#2a2829","#493736","#7b3b3b"],["#bbbb88","#ccc68d","#eedd99","#eec290","#eeaa88"],["#b3cc57","#ecf081","#ffbe40","#ef746f","#ab3e5b"],["#a3a948","#edb92e","#f85931","#ce1836","#009989"],["#300030","#480048","#601848","#c04848","#f07241"],["#67917a","#170409","#b8af03","#ccbf82","#e33258"],["#aab3ab","#c4cbb7","#ebefc9","#eee0b7","#e8caaf"],["#e8d5b7","#0e2430","#fc3a51","#f5b349","#e8d5b9"],["#ab526b","#bca297","#c5ceae","#f0e2a4","#f4ebc3"],["#607848","#789048","#c0d860","#f0f0d8","#604848"],["#b6d8c0","#c8d9bf","#dadabd","#ecdbbc","#fedcba"],["#a8e6ce","#dcedc2","#ffd3b5","#ffaaa6","#ff8c94"],["#3e4147","#fffedf","#dfba69","#5a2e2e","#2a2c31"],["#fc354c","#29221f","#13747d","#0abfbc","#fcf7c5"],["#cc0c39","#e6781e","#c8cf02","#f8fcc1","#1693a7"],["#1c2130","#028f76","#b3e099","#ffeaad","#d14334"],["#a7c5bd","#e5ddcb","#eb7b59","#cf4647","#524656"],["#dad6ca","#1bb0ce","#4f8699","#6a5e72","#563444"],["#5c323e","#a82743","#e15e32","#c0d23e","#e5f04c"],["#edebe6","#d6e1c7","#94c7b6","#403b33","#d3643b"],["#fdf1cc","#c6d6b8","#987f69","#e3ad40","#fcd036"],["#230f2b","#f21d41","#ebebbc","#bce3c5","#82b3ae"],["#b9d3b0","#81bda4","#b28774","#f88f79","#f6aa93"],["#3a111c","#574951","#83988e","#bcdea5","#e6f9bc"],["#5e3929","#cd8c52","#b7d1a3","#dee8be","#fcf7d3"],["#1c0113","#6b0103","#a30006","#c21a01","#f03c02"],["#000000","#9f111b","#b11623","#292c37","#cccccc"],["#382f32","#ffeaf2","#fcd9e5","#fbc5d8","#f1396d"],["#e3dfba","#c8d6bf","#93ccc6","#6cbdb5","#1a1f1e"],["#f6f6f6","#e8e8e8","#333333","#990100","#b90504"],["#1b325f","#9cc4e4","#e9f2f9","#3a89c9","#f26c4f"],["#a1dbb2","#fee5ad","#faca66","#f7a541","#f45d4c"],["#c1b398","#605951","#fbeec2","#61a6ab","#accec0"],["#5e9fa3","#dcd1b4","#fab87f","#f87e7b","#b05574"],["#951f2b","#f5f4d7","#e0dfb1","#a5a36c","#535233"],["#8dccad","#988864","#fea6a2","#f9d6ac","#ffe9af"],["#2d2d29","#215a6d","#3ca2a2","#92c7a3","#dfece6"],["#413d3d","#040004","#c8ff00","#fa023c","#4b000f"],["#eff3cd","#b2d5ba","#61ada0","#248f8d","#605063"],["#ffefd3","#fffee4","#d0ecea","#9fd6d2","#8b7a5e"],["#cfffdd","#b4dec1","#5c5863","#a85163","#ff1f4c"],["#9dc9ac","#fffec7","#f56218","#ff9d2e","#919167"],["#4e395d","#827085","#8ebe94","#ccfc8e","#dc5b3e"],["#a8a7a7","#cc527a","#e8175d","#474747","#363636"],["#f8edd1","#d88a8a","#474843","#9d9d93","#c5cfc6"],["#046d8b","#309292","#2fb8ac","#93a42a","#ecbe13"],["#f38a8a","#55443d","#a0cab5","#cde9ca","#f1edd0"],["#a70267","#f10c49","#fb6b41","#f6d86b","#339194"],["#ff003c","#ff8a00","#fabe28","#88c100","#00c176"],["#ffedbf","#f7803c","#f54828","#2e0d23","#f8e4c1"],["#4e4d4a","#353432","#94ba65","#2790b0","#2b4e72"],["#0ca5b0","#4e3f30","#fefeeb","#f8f4e4","#a5b3aa"],["#4d3b3b","#de6262","#ffb88c","#ffd0b3","#f5e0d3"],["#fffbb7","#a6f6af","#66b6ab","#5b7c8d","#4f2958"],["#edf6ee","#d1c089","#b3204d","#412e28","#151101"],["#9d7e79","#ccac95","#9a947c","#748b83","#5b756c"],["#fcfef5","#e9ffe1","#cdcfb7","#d6e6c3","#fafbe3"],["#9cddc8","#bfd8ad","#ddd9ab","#f7af63","#633d2e"],["#30261c","#403831","#36544f","#1f5f61","#0b8185"],["#aaff00","#ffaa00","#ff00aa","#aa00ff","#00aaff"],["#d1313d","#e5625c","#f9bf76","#8eb2c5","#615375"],["#ffe181","#eee9e5","#fad3b2","#ffba7f","#ff9c97"],["#73c8a9","#dee1b6","#e1b866","#bd5532","#373b44"],["#805841","#dcf7f3","#fffcdd","#ffd8d8","#f5a2a2"]],getDebugLayoutObject2=lo3=>{let{x:x4,y:y4,width,height}={...lo3,...lo3.size,...lo3.center,...lo3.position};if(lo3.x1!==void 0&&lo3.x2!==void 0&&lo3.y1!==void 0&&lo3.y2!==void 0&&(x4=(lo3.x1+lo3.x2)/2,y4=(lo3.y1+lo3.y2)/2,width=Math.abs(lo3.x1-lo3.x2),height=Math.abs(lo3.y1-lo3.y2)),lo3.points&&Array.isArray(lo3.points)&&lo3.points.length>0){let xCoords=lo3.points.map(point23=>point23.x),yCoords=lo3.points.map(point23=>point23.y),minX=Math.min(...xCoords),maxX=Math.max(...xCoords),minY=Math.min(...yCoords),maxY=Math.max(...yCoords);x4=(minX+maxX)/2,y4=(minY+maxY)/2,width=maxX-minX,height=maxY-minY}let title=lo3.text||lo3.name||lo3.source?.text||lo3.source?.name||"?",content=lo3;return x4===void 0||y4===void 0?null:(width===void 0&&"outer_diameter"in lo3&&(width=lo3.outer_diameter,height=lo3.outer_diameter),(width===void 0||height===void 0)&&(width=.1,height=.1),{x:x4,y:y4,width,height,title,content,bg_color:nice_color_palettes2[stringHash3(lo3.type||title)%nice_color_palettes2.length]?.[4]??"#f00"})},isTruthy2=value=>!!value,findBoundsAndCenter2=elements=>{let debugObjects=elements.filter(elm=>elm.type.startsWith("pcb_")||elm.type.startsWith("schematic_")).concat(elements.filter(elm=>elm.type==="pcb_trace"||elm.type==="schematic_trace").flatMap(elm=>elm.route)).map(elm=>getDebugLayoutObject2(elm)).filter(isTruthy2);if(debugObjects.length===0)return{center:{x:0,y:0},width:0,height:0};let minX=debugObjects[0].x-debugObjects[0].width/2,maxX=debugObjects[0].x+debugObjects[0].width/2,minY=debugObjects[0].y-debugObjects[0].height/2,maxY=debugObjects[0].y+debugObjects[0].height/2;for(let obj of debugObjects.slice(1))minX=Math.min(minX,obj.x-obj.width/2),maxX=Math.max(maxX,obj.x+obj.width/2),minY=Math.min(minY,obj.y-obj.height/2),maxY=Math.max(maxY,obj.y+obj.height/2);let width=maxX-minX,height=maxY-minY;return{center:{x:minX+width/2,y:minY+height/2},width,height}},unitToMm3={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},mmNumberFormatter2=new Intl.NumberFormat("en-US",{useGrouping:!1,notation:"standard",maximumFractionDigits:12}),mm5=n4=>{let unit=typeof n4=="number"?"mm":n4.replace(/^[^a-zA-Z]+/g,"").toLowerCase();unit||(unit="mm");let val=typeof n4=="number"?n4:Number.parseFloat(n4.split(unit)[0]);if(unit in unitToMm3)return val*unitToMm3[unit];throw new Error(`Unsupported unit: ${unit}`)},mil2mm2=mil=>typeof mil=="number"?mm5(`${mil}mil`):mil.match(/^\d+$/)?mm5(`${mil}mil`):mm5(mil);function generateArcFromSweep(startX,startY,endX,endY,radius,largeArcFlag,sweepFlag){let start={x:startX,y:startY},end={x:endX,y:endY},midX=(startX+endX)/2,midY=(startY+endY)/2,dx3=endX-startX,dy3=endY-startY,distance33=Math.sqrt(dx3*dx3+dy3*dy3);if(distance33===0||radius<distance33/2)return[start,end];let h6=Math.sqrt(radius*radius-distance33*distance33/4),angle=Math.atan2(dy3,dx3),centerX=midX+h6*Math.sin(angle)*(sweepFlag?-1:1),centerY=midY-h6*Math.cos(angle)*(sweepFlag?-1:1),startAngle=Math.atan2(startY-centerY,startX-centerX),endAngle=Math.atan2(endY-centerY,endX-centerX);sweepFlag&&endAngle>startAngle?endAngle-=2*Math.PI:!sweepFlag&&endAngle<startAngle&&(endAngle+=2*Math.PI),(!largeArcFlag&&Math.abs(endAngle-startAngle)>Math.PI||largeArcFlag&&Math.abs(endAngle-startAngle)<Math.PI)&&(endAngle>startAngle?endAngle-=2*Math.PI:endAngle+=2*Math.PI);let numPoints=Math.max(2,Math.ceil(Math.abs(endAngle-startAngle)*radius)),path=[];for(let i3=0;i3<=numPoints;i3++){let t52=i3/numPoints,angle2=startAngle+t52*(endAngle-startAngle),x4=centerX+radius*Math.cos(angle2),y4=centerY+radius*Math.sin(angle2);path.push({x:x4,y:y4})}return path}var mil10ToMm=value=>value*10*.0254,getBoundsCenter2=bounds=>({x:(bounds.minX+bounds.maxX)/2,y:(bounds.minY+bounds.maxY)/2}),getBoundsFromPoints2=points=>{if(points.length===0)return null;let minX=points[0].x,minY=points[0].y,maxX=points[0].x,maxY=points[0].y;for(let i3=1;i3<points.length;i3++){let point23=points[i3];point23.x<minX&&(minX=point23.x),point23.y<minY&&(minY=point23.y),point23.x>maxX&&(maxX=point23.x),point23.y>maxY&&(maxY=point23.y)}return{minX,minY,maxX,maxY}},getCadSvgNode=easyEdaJson=>{let svgNode=easyEdaJson.packageDetail.dataStr.shape.find(shape=>shape.type==="SVGNODE"&&shape.svgData.attrs?.uuid);return svgNode?.type==="SVGNODE"?svgNode:null},isSvgChildNodeWithAttrs=childNode=>typeof childNode=="object"&&childNode!==null,getXyBoundsFromModelBounds=bounds=>({minX:bounds.min.x,minY:bounds.min.y,maxX:bounds.max.x,maxY:bounds.max.y}),rotateScenePoint=(point23,rotationDeg)=>{switch(rotationDeg){case 0:return point23;case 90:return{x:point23.y,y:-point23.x};case 180:return{x:-point23.x,y:-point23.y};case 270:return{x:-point23.y,y:point23.x}}},getEasyEdaModelOriginOnBoardMm=({svgNode,footprintCenterMm})=>{let points=[];for(let childNode of svgNode.svgData.childNodes??[]){if(!isSvgChildNodeWithAttrs(childNode))continue;let rawPoints=childNode.attrs?.points;if(!rawPoints)continue;let values=String(rawPoints).trim().split(/\s+/).map(Number);for(let i3=0;i3+1<values.length;i3+=2){let x4=values[i3],y4=values[i3+1];Number.isFinite(x4)&&Number.isFinite(y4)&&points.push({x:mil10ToMm(x4),y:mil10ToMm(y4)})}}let modelOriginMm=null;if(points.length>0){let bounds=getBoundsFromPoints2(points);modelOriginMm=bounds?getBoundsCenter2(bounds):null}else{let[originX,originY]=String(svgNode.svgData.attrs?.c_origin??"0,0").split(",").map(value=>Number(value.trim()));Number.isFinite(originX)&&Number.isFinite(originY)&&(modelOriginMm={x:mil10ToMm(originX),y:mil10ToMm(originY)})}return modelOriginMm?{x:modelOriginMm.x-footprintCenterMm.x,y:footprintCenterMm.y-modelOriginMm.y}:null},snapZero=value=>Math.abs(value)<1e-6?0:value,normalizePoint=point23=>({x:snapZero(point23.x),y:snapZero(point23.y)}),getCadModelOffsetMmFromBounds=(easyEdaJson,bounds,{footprintBoundsCenterMm}={})=>{let svgNode=getCadSvgNode(easyEdaJson);if(!svgNode||!bounds)return null;let[,,rotationZRaw]=String(svgNode.svgData.attrs?.c_rotation??"0,0,0").split(",").map(value=>Number(value.trim())),rotationDeg=(rotationZRaw%360+360)%360;if(![0,90,180,270].includes(rotationDeg))return null;let modelCenter=getBoundsCenter2(getXyBoundsFromModelBounds(bounds)),footprintCenter=easyEdaJson.packageDetail.dataStr.head,footprintCenterMm=footprintBoundsCenterMm??{x:mil10ToMm(footprintCenter.x),y:mil10ToMm(footprintCenter.y)},targetOriginOnBoardMm=getEasyEdaModelOriginOnBoardMm({svgNode,footprintCenterMm});if(!targetOriginOnBoardMm)return null;let targetOriginInModelFrame=rotateScenePoint(targetOriginOnBoardMm,rotationDeg);return normalizePoint({x:modelCenter.x-targetOriginInModelFrame.x,y:modelCenter.y-targetOriginInModelFrame.y})},normalizePinLabels2=inputPinLabels=>{let uniqueInputPinLabels=inputPinLabels.map(labels=>[...new Set(labels)]),result=uniqueInputPinLabels.map(()=>[]),desiredNumbers=uniqueInputPinLabels.map(()=>null);for(let i3=0;i3<uniqueInputPinLabels.length;i3++)for(let label of uniqueInputPinLabels[i3])if(/^\d+$/.test(label)){desiredNumbers[i3]=Number.parseInt(label);break}let highestPinNumber=0,acceptedDesiredNumbers=new Set;for(let i3=0;i3<desiredNumbers.length;i3++){let desiredNumber=desiredNumbers[i3];if(desiredNumber===null||desiredNumber<1)continue;if(!acceptedDesiredNumbers.has(desiredNumber)){acceptedDesiredNumbers.add(desiredNumber),result[i3].push(`pin${desiredNumber}`),highestPinNumber=Math.max(highestPinNumber,desiredNumber);continue}let existingAltCount=0;for(let label of result[i3])label.startsWith(`pin${desiredNumber}_alt`)&&(existingAltCount+=1);result[i3].push(`pin${desiredNumber}_alt${existingAltCount+1}`)}for(let i3=0;i3<result.length;i3++)result[i3][0]?.includes("_alt")&&(highestPinNumber+=1,result[i3].unshift(`pin${highestPinNumber}`));for(let i3=0;i3<result.length;i3++)result[i3].length===0&&(highestPinNumber+=1,result[i3].push(`pin${highestPinNumber}`));let totalLabelCounts={};for(let inputLabels of uniqueInputPinLabels)for(let label of inputLabels)/^\d+$/.test(label)||(totalLabelCounts[label]=(totalLabelCounts[label]??0)+1);let incrementalLabelCounts={};for(let i3=0;i3<uniqueInputPinLabels.length;i3++)for(let label of uniqueInputPinLabels[i3])/^\d+$/.test(label)||(totalLabelCounts[label]===1?result[i3].push(label):(incrementalLabelCounts[label]=(incrementalLabelCounts[label]??0)+1,result[i3].push(`${label}${incrementalLabelCounts[label]}`)));return result},normalizeSymbolName=name=>{let trimmedName=name.trim();return trimmedName==="+"?"_POS":trimmedName==="-"?"_NEG":trimmedName},DEFAULT_PCB_THICKNESS_MM=1.6,EASYEDA_STEP_MODEL_URL="https://modules.easyeda.com/qAxj6KHrDKw4blvCG8QJPs7Y",EASYEDA_OBJ_MODEL_URL="https://modules.easyeda.com/3dmodel",TSCIRCUIT_MODEL_CDN_URL="https://modelcdn.tscircuit.com/easyeda_models",milx10=mil10=>typeof mil10=="number"||mil10.match(/^\d+$/)?mil2mm2(mil10)*10:mil2mm2(mil10),parseCadOffsetsFromSvgNode=svgNode=>{let attrs=svgNode?.svgData?.attrs??{},[cx3,cy3]=String(attrs.c_origin??"0,0").split(",").map(s3=>Number(s3.trim())),zStr=attrs.z??0,z_mm=typeof zStr=="string"&&/[a-z]/i.test(zStr)?mm5(zStr):mm5(`${Number(zStr)||0}mil`);return{position:{x:mil10ToMm(Number.isNaN(cx3)?0:cx3),y:mil10ToMm(Number.isNaN(cy3)?0:cy3),z:z_mm},rotation:(()=>{let[rx3,ry3,rz2]=(attrs.c_rotation??"0,0,0").split(",").map(Number);return{x:rx3||0,y:ry3||0,z:rz2||0}})()}},readModelHeightMm=raw=>{if(raw==null)return 3.5;let n4=Number(raw);if(!Number.isFinite(n4))return 3.5;let mmFromMil10=mil10ToMm(n4),mmFromMil=mm5(`${n4}mil`),upper=12,lower=.1,chosen=Math.max(mmFromMil10,mmFromMil);return(chosen>upper||chosen<lower)&&(chosen=3.5),chosen},handleSilkscreenPath=(track,index)=>pcb_silkscreen_path2.parse({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_path_${index+1}`,pcb_component_id:"pcb_component_1",layer:"top",route:track.points.map(point23=>({x:milx10(point23.x),y:milx10(point23.y)})),stroke_width:mil10ToMm(track.width)}),isCourtyardLayer=layer=>layer===13||layer===14||layer===15,handleSilkscreenArc=(arc2,index)=>{let arcPath=generateArcFromSweep(arc2.start.x,arc2.start.y,arc2.end.x,arc2.end.y,arc2.radiusX,arc2.largeArc,arc2.sweepDirection==="CW");return pcb_silkscreen_path2.parse({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_arc_${index+1}`,pcb_component_id:"pcb_component_1",layer:"top",route:arcPath.map(p4=>({x:milx10(p4.x),y:milx10(p4.y)})),stroke_width:mil10ToMm(arc2.width)})},handleHole=(hole,index)=>pcb_hole2.parse({type:"pcb_hole",x:milx10(hole.center.x),y:milx10(hole.center.y),hole_diameter:milx10(hole.radius)*2,hole_shape:"circle",pcb_hole_id:`pcb_hole_${index+1}`}),handleHoleCutout=(hole,index)=>pcb_cutout2.parse({type:"pcb_cutout",pcb_cutout_id:`pcb_cutout_from_hole_${index+1}`,shape:"circle",center:{x:milx10(hole.center.x),y:milx10(hole.center.y)},radius:milx10(hole.radius)}),handleVia=(via,index)=>pcb_via2.parse({type:"pcb_via",pcb_via_id:`pcb_via_${index+1}`,x:milx10(via.center.x),y:milx10(via.center.y),outer_diameter:milx10(via.outerDiameter),hole_diameter:milx10(via.holeDiameter),layers:["top","bottom"]}),handleCutout=(solidRegion,index)=>pcb_cutout2.parse({type:"pcb_cutout",pcb_cutout_id:`pcb_cutout_${index+1}`,shape:"polygon",points:solidRegion.points.map(p4=>({x:milx10(p4.x),y:milx10(p4.y)}))}),LEAD_SHAPE_LAYER=100,isPcbSolidRegionCutout=shape=>shape.fillStyle==="cutout"&&shape.layermask!==LEAD_SHAPE_LAYER,getCadPositionZMmFromMetadata=easyEdaJson=>{let svgNode=easyEdaJson.packageDetail.dataStr.shape.find(shape=>shape.type==="SVGNODE"&&shape.svgData.attrs?.uuid);if(!svgNode||svgNode.type!=="SVGNODE")return;let svgNodeZ=Number(svgNode.svgData.attrs?.z??0);if(!Number.isFinite(svgNodeZ))return;let bounds=easyEdaJson._objMetadata?.bounds;return bounds?(Math.abs(bounds.min.z)<1e-6?0:bounds.min.z)-mil10ToMm(svgNodeZ):void 0},convertEasyEdaJsonToCircuitJson=(easyEdaJson,{useModelCdn,shouldRecenter=!0,cadPositionXMm,cadPositionYMm,cadPositionZMm,cadModelBounds,showDesignator=!1}={})=>{let resolvedCadPositionZMm=cadPositionZMm??getCadPositionZMmFromMetadata(easyEdaJson),circuitElements=[],source_component=any_source_component2.parse({type:"source_component",source_component_id:"source_component_1",name:"U1",ftype:"simple_chip"}),pcb_component22=pcb_component2.parse({type:"pcb_component",pcb_component_id:"pcb_component_1",source_component_id:"source_component_1",name:"U1",ftype:"simple_chip",width:0,height:0,rotation:0,center:{x:0,y:0},layer:"top"});circuitElements.push(source_component,pcb_component22);let pads=easyEdaJson.packageDetail.dataStr.shape.filter(shape=>shape.type==="PAD"),pins=easyEdaJson.dataStr.shape.filter(shape=>shape.type==="PIN"),pinLabelSets=pads.map(pad2=>{let labels=[];pad2.number&&labels.push(pad2.number.toString());let pin=pins.find(p4=>p4.pinNumber===pad2.number);return pin&&labels.push(normalizeSymbolName(pin.label)),labels}),normalizedPinLabels=normalizePinLabels2(pinLabelSets);pads.forEach((pad2,index)=>{let portHints2=normalizedPinLabels[index],pinNumber=Number.parseInt(portHints2.find(hint=>hint.match(/pin\d+/)).replace("pin",""));if(circuitElements.push({type:"source_port",source_port_id:`source_port_${index+1}`,source_component_id:"source_component_1",name:`pin${pinNumber}`,pin_number:pinNumber,port_hints:portHints2.filter(hint=>hint!==`pin${pinNumber}`)}),pad2.holeRadius!==void 0&&mil2mm2(pad2.holeRadius)!==0){let commonPlatedHoleProps={type:"pcb_plated_hole",pcb_plated_hole_id:pad2.shape==="RECT"&&pad2.rotation!==void 0?`pcb_plated_hole_${index+1}_rot${pad2.rotation}`:`pcb_plated_hole_${index+1}`,x:mil2mm2(pad2.center.x),y:mil2mm2(pad2.center.y),layers:["top"],port_hints:[`pin${pinNumber}`],pcb_component_id:"pcb_component_1",pcb_port_id:`pcb_port_${index+1}`},additionalPlatedHoleProps;if(pad2.shape==="OVAL"){let largestOuterDimensionName=mil2mm2(pad2.width)>mil2mm2(pad2.height)?"width":"height",smallestOuterDimension=Math.min(mil2mm2(pad2.width),mil2mm2(pad2.height)),largestOuterDimension=Math.max(mil2mm2(pad2.width),mil2mm2(pad2.height)),distanceFromOuterPlatingToHole=smallestOuterDimension/2-mil2mm2(pad2.holeRadius),largestInnerDimension=largestOuterDimension-distanceFromOuterPlatingToHole*2,smallestInnerDimension=mil2mm2(pad2.holeRadius)*2;additionalPlatedHoleProps={shape:"pill",hole_width:largestOuterDimensionName==="width"?largestInnerDimension:smallestInnerDimension,hole_height:largestOuterDimensionName==="height"?largestInnerDimension:smallestInnerDimension,outer_width:mil2mm2(pad2.width),outer_height:mil2mm2(pad2.height),ccw_rotation:pad2.rotation||0}}else if(pad2.shape==="RECT"){let padWidth=mil2mm2(pad2.width),padHeight=mil2mm2(pad2.height),holeDiameter=mil2mm2(pad2.holeRadius)*2;if(Math.max(padWidth,padHeight)/Math.min(padWidth,padHeight)>1.5){let baseWidth=holeDiameter,pillHeight=baseWidth*2.6,holeWidth=padWidth>padHeight?pillHeight:baseWidth,holeHeight=padHeight>padWidth?pillHeight:baseWidth;additionalPlatedHoleProps={shape:"rotated_pill_hole_with_rect_pad",hole_shape:"rotated_pill",pad_shape:"rect",hole_width:holeWidth,hole_height:holeHeight,hole_ccw_rotation:pad2.rotation||0,rect_ccw_rotation:pad2.rotation||0,rect_pad_width:padWidth,rect_pad_height:padHeight}}else additionalPlatedHoleProps={shape:"circle",hole_diameter:holeDiameter,outer_diameter:Math.max(padWidth,padHeight),radius:holeDiameter/2}}else additionalPlatedHoleProps={shape:"circle",hole_diameter:mil2mm2(pad2.holeRadius)*2,outer_diameter:mil2mm2(pad2.width),radius:mil2mm2(pad2.holeRadius)};circuitElements.push(pcb_plated_hole2.parse({...commonPlatedHoleProps,...additionalPlatedHoleProps}))}else{let soupShape;if(pad2.shape==="RECT"||pad2.shape==="ELLIPSE"?soupShape="rect":pad2.shape==="OVAL"?soupShape="pill":pad2.shape==="POLYGON"&&(soupShape="polygon"),!soupShape)throw new Error(`unknown pad.shape: "${pad2.shape}"`);let rectSize={width:mil2mm2(pad2.width),height:mil2mm2(pad2.height)};(pad2.rotation===90||pad2.rotation===270)&&(rectSize.width=mil2mm2(pad2.height),rectSize.height=mil2mm2(pad2.width));let parsedPcbSmtpad=pcb_smtpad2.parse({type:"pcb_smtpad",pcb_smtpad_id:`pcb_smtpad_${index+1}`,shape:soupShape,...soupShape!=="polygon"&&{x:mil2mm2(pad2.center.x),y:mil2mm2(pad2.center.y)},...soupShape==="rect"?rectSize:soupShape==="pill"?{...rectSize,radius:Math.min(rectSize.width,rectSize.height)/2}:soupShape==="polygon"&&pad2.points?{points:pad2.points.map(p4=>({x:milx10(p4.x),y:milx10(p4.y)}))}:{radius:Math.min(mil2mm2(pad2.width),mil2mm2(pad2.height))/2},layer:"top",port_hints:[`pin${pinNumber}`],pcb_component_id:"pcb_component_1",pcb_port_id:`pcb_port_${index+1}`});circuitElements.push(parsedPcbSmtpad)}}),easyEdaJson.packageDetail.dataStr.shape.filter(shape=>shape.type==="HOLE").forEach((h6,index)=>{circuitElements.push(handleHole(h6,index)),circuitElements.push(handleHoleCutout(h6,index))}),easyEdaJson.packageDetail.dataStr.shape.filter(shape=>shape.type==="VIA").forEach((v4,index)=>{circuitElements.push(handleVia(v4,index))}),easyEdaJson.packageDetail.dataStr.shape.filter(shape=>shape.type==="SOLIDREGION"&&isPcbSolidRegionCutout(shape)).forEach((sr3,index)=>{circuitElements.push(handleCutout(sr3,index))});let hasFoundDesignator=!1;if(easyEdaJson.packageDetail.dataStr.shape.forEach((shape,index)=>{if(shape.type==="TRACK")isCourtyardLayer(shape.layer)||circuitElements.push(handleSilkscreenPath(shape,index));else if(shape.type==="ARC")isCourtyardLayer(shape.layer)||circuitElements.push(handleSilkscreenArc(shape,index));else if(shape.type==="TEXT"){if(isCourtyardLayer(shape.layer))return;let text=shape.text,designatorPrefix=easyEdaJson.dataStr.head.c_para.pre||"U",normalizedPrefix=designatorPrefix.replace(/\?/g,""),trimmedText=text.trim();if(trimmedText===designatorPrefix||trimmedText===`${normalizedPrefix}?`||trimmedText===normalizedPrefix){if(!showDesignator)return;text="{NAME}",hasFoundDesignator=!0}circuitElements.push(pcb_silkscreen_text2.parse({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pcb_silkscreen_text_${index+1}`,pcb_component_id:"pcb_component_1",text,anchor_position:{x:mil2mm2(shape.x),y:mil2mm2(shape.y)},anchor_alignment:{L:"bottom_left",C:"center",R:"bottom_right"}[shape.textAnchor??"L"],font_size:shape.size_mm||1,layer:"top"}))}}),!hasFoundDesignator&&showDesignator){let bbox=easyEdaJson.packageDetail.dataStr.BBox;circuitElements.push(pcb_silkscreen_text2.parse({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"pcb_silkscreen_text_designator_fallback",pcb_component_id:"pcb_component_1",text:"{NAME}",anchor_position:{x:milx10(bbox.x+bbox.width/2),y:milx10(bbox.y)-1},anchor_alignment:"center",font_size:1,layer:"top"}))}let pcbElements=circuitElements.filter(e5=>e5.type==="pcb_smtpad"||e5.type==="pcb_plated_hole"||e5.type==="pcb_hole"||e5.type==="pcb_via"||e5.type==="pcb_courtyard_outline"||e5.type==="pcb_silkscreen_path"||e5.type==="pcb_silkscreen_text");if(pcbElements.length>0){let bounds=findBoundsAndCenter2(pcbElements);pcb_component22.width=bounds.width,pcb_component22.height=bounds.height}let svgNode=easyEdaJson.packageDetail.dataStr.shape.find(a3=>!!(a3.type==="SVGNODE"&&a3.svgData.attrs?.uuid)),modelUuid=svgNode?.svgData?.attrs?.uuid,objFileUrl=modelUuid?useModelCdn?`${TSCIRCUIT_MODEL_CDN_URL}/assets/${easyEdaJson.lcsc.number}.obj?uuid=${modelUuid}`:`${EASYEDA_OBJ_MODEL_URL}/${modelUuid}`:void 0,stepFileUrl=modelUuid?useModelCdn?`${TSCIRCUIT_MODEL_CDN_URL}/assets/${easyEdaJson.lcsc.number}.step?uuid=${modelUuid}`:`${EASYEDA_STEP_MODEL_URL}/${modelUuid}`:void 0;if(objFileUrl!==void 0||stepFileUrl!==void 0){let{position:position22,rotation:rotation22}=parseCadOffsetsFromSvgNode(svgNode);circuitElements.push(cad_component2.parse({type:"cad_component",cad_component_id:"cad_component_1",source_component_id:"source_component_1",pcb_component_id:"pcb_component_1",anchor_alignment:"center_of_component_on_board_surface",model_origin_alignment:"center_of_component_on_board_surface",model_origin_position:{x:cadPositionXMm??0,y:cadPositionYMm??0,z:resolvedCadPositionZMm??position22.z},position:{x:0,y:0,z:0},rotation:rotation22,model_obj_url:objFileUrl,model_step_url:stepFileUrl}))}if(!circuitElements.some(e5=>e5.type==="pcb_courtyard_outline")){let bbox=easyEdaJson.packageDetail.dataStr.BBox;if(bbox){let x12=milx10(bbox.x)-.25,y12=milx10(bbox.y)-.25,x22=milx10(bbox.x+bbox.width)+.25,y22=milx10(bbox.y+bbox.height)+.25;circuitElements.push(pcb_courtyard_outline2.parse({type:"pcb_courtyard_outline",pcb_courtyard_outline_id:`pcb_courtyard_outline_${easyEdaJson.lcsc.number}_1`,pcb_component_id:"pcb_component_1",layer:"top",outline:[{x:x12,y:y12},{x:x22,y:y12},{x:x22,y:y22},{x:x12,y:y22},{x:x12,y:y12}],stroke_width:.05}))}}if(shouldRecenter){let elementsForBounds=circuitElements.filter(e5=>e5.type!=="pcb_component"&&e5.type!=="cad_component"),bounds=findBoundsAndCenter2(elementsForBounds);if(Number.isFinite(bounds.center.x)&&Number.isFinite(bounds.center.y)){let matrix2=compose4(translate4(-bounds.center.x,bounds.center.y),scale4(1,-1)),elementsForTransform=circuitElements.filter(e5=>!(e5.type==="pcb_smtpad"&&e5.shape==="polygon")&&e5.type!=="cad_component");transformPCBElements2(elementsForTransform,matrix2);for(let e5 of circuitElements)if(e5.type==="pcb_cutout"){if(e5.shape==="polygon")e5.points=e5.points.map(p4=>applyToPoint4(matrix2,p4));else if(e5.shape==="circle"||e5.shape==="rect")e5.center=applyToPoint4(matrix2,e5.center);else if("route"in e5){let cutoutPath=e5;cutoutPath.route=cutoutPath.route.map(p4=>applyToPoint4(matrix2,p4))}}else e5.type==="pcb_smtpad"&&e5.shape==="polygon"&&(e5.points=e5.points.map(p4=>applyToPoint4(matrix2,p4)));let cad=circuitElements.find(e5=>e5.type==="cad_component");if(cad){cad.rotation||(cad.rotation={x:0,y:0,z:0}),cad.model_origin_position||(cad.model_origin_position={x:0,y:0,z:0});let resolvedCadModelBounds=cadModelBounds??easyEdaJson._objMetadata?.bounds,recenteredCadOffset=resolvedCadModelBounds&&getCadModelOffsetMmFromBounds(easyEdaJson,resolvedCadModelBounds,{footprintBoundsCenterMm:bounds.center});recenteredCadOffset&&(cad.model_origin_position.x=recenteredCadOffset.x,cad.model_origin_position.y=recenteredCadOffset.y);let side=pcb_component22.layer??"top",t52=DEFAULT_PCB_THICKNESS_MM/2,attrs=svgNode?.svgData?.attrs??{},modelHeight=readModelHeightMm(attrs.c_height);cad.size||(cad.size={x:pcb_component22.width,y:pcb_component22.height,z:modelHeight});let ROTATE_X_FOR_YUP=90,originalZRotation=(cad.rotation.z??0)%360;Math.abs(originalZRotation-0)<1||Math.abs(originalZRotation-360)<1||Math.abs(originalZRotation-180)<1||Math.abs(originalZRotation-90)<1?cad.rotation.x=((cad.rotation.x??0)+0+360)%360:Math.abs(originalZRotation-270)<1?(cad.rotation.x=((cad.rotation.x??0)+0+360)%360,cad.rotation.y=((cad.rotation.y??0)+0+360)%360):(console.warn(`[3D] Unusual rotation angle: ${originalZRotation}\xB0 for component ${easyEdaJson.lcsc.number}`),cad.rotation.x=((cad.rotation.x??0)+ROTATE_X_FOR_YUP+360)%360),side!=="top"&&(cad.rotation.x=((cad.rotation.x??0)+180)%360);let USE_Z_OFFSET_FOR_180=Math.abs(originalZRotation-180)<1,zOffRaw=cad.model_origin_position.z??cad.position.z??0,zOff=USE_Z_OFFSET_FOR_180?-zOffRaw:0,rx3=(cad.rotation.x%360+360)%360,thicknessAlongWorldZ,is180RotatedYUp=(Math.abs(originalZRotation-180)<1||Math.abs(originalZRotation-0)<1||Math.abs(originalZRotation-360)<1)&&Math.abs(rx3)<1;if(is180RotatedYUp||rx3%180===90?thicknessAlongWorldZ=cad.size.y:thicknessAlongWorldZ=cad.size.z,Number.isFinite(resolvedCadPositionZMm))cad.model_origin_position.z=side==="top"?resolvedCadPositionZMm:-resolvedCadPositionZMm;else{let centerZ;is180RotatedYUp?centerZ=side==="top"?t52-thicknessAlongWorldZ/2:-t52+thicknessAlongWorldZ/2:centerZ=side==="top"?t52+zOff+thicknessAlongWorldZ/2:-t52-zOff-thicknessAlongWorldZ/2,cad.model_origin_position.z=centerZ}}}pcb_component22.center={x:0,y:0}}return circuitElements},safeNumber=(defaultValue=0)=>external_exports2.union([external_exports2.number(),external_exports2.string()]).transform(val=>{let num=Number(val);return isNaN(num)?defaultValue:num}).default(defaultValue),tenthmil=external_exports2.union([external_exports2.number(),external_exports2.string()]).optional().transform(n4=>typeof n4=="string"&&n4.endsWith("mil")?n4:`${Number.parseFloat(n4)*10}mil`).pipe(external_exports2.string()),PointSchema=external_exports2.any().transform(p4=>{if(Array.isArray(p4)){let[x4,y4]=p4;return{x:x4,y:y4}}if(typeof p4=="object")return p4;throw new Error(`Invalid point: ${p4}`)}).pipe(external_exports2.object({x:external_exports2.number(),y:external_exports2.number()})),BaseShapeSchema=external_exports2.object({type:external_exports2.string(),id:external_exports2.string().optional(),layer:external_exports2.coerce.number().optional()}),TrackSchema=BaseShapeSchema.extend({type:external_exports2.literal("TRACK"),width:external_exports2.coerce.number(),points:external_exports2.array(PointSchema)}),PadSchema=BaseShapeSchema.extend({type:external_exports2.literal("PAD"),shape:external_exports2.enum(["RECT","ELLIPSE","OVAL","POLYGON"]),center:external_exports2.object({x:tenthmil,y:tenthmil}),width:tenthmil,height:tenthmil,layermask:external_exports2.number(),net:external_exports2.union([external_exports2.string(),external_exports2.number()]).optional(),number:external_exports2.union([external_exports2.string(),external_exports2.number()]),holeRadius:tenthmil,points:external_exports2.array(PointSchema).optional(),rotation:safeNumber(0),plated:external_exports2.boolean()}),ArcSchema=BaseShapeSchema.extend({type:external_exports2.literal("ARC"),width:external_exports2.number(),start:PointSchema,end:PointSchema,radiusX:external_exports2.number(),radiusY:external_exports2.number(),largeArc:external_exports2.boolean(),sweepDirection:external_exports2.enum(["CW","CCW"])}),CircleSchema=BaseShapeSchema.extend({type:external_exports2.literal("CIRCLE"),center:PointSchema,radius:external_exports2.number(),width:external_exports2.number()}),SolidRegionSchema=BaseShapeSchema.extend({type:external_exports2.literal("SOLIDREGION"),layermask:external_exports2.number(),points:external_exports2.array(PointSchema),fillStyle:external_exports2.string()}),SVGNodeSchema=BaseShapeSchema.extend({type:external_exports2.literal("SVGNODE"),svgData:external_exports2.object({gId:external_exports2.string(),nodeName:external_exports2.string(),nodeType:external_exports2.number(),layerid:external_exports2.string(),attrs:external_exports2.record(external_exports2.string(),external_exports2.string()),childNodes:external_exports2.array(external_exports2.unknown())})}),HoleSchema=BaseShapeSchema.extend({type:external_exports2.literal("HOLE"),center:PointSchema,radius:external_exports2.number()}),ViaSchema=BaseShapeSchema.extend({type:external_exports2.literal("VIA"),center:PointSchema,outerDiameter:external_exports2.number(),holeDiameter:external_exports2.number()}),RectSchema=BaseShapeSchema.extend({type:external_exports2.literal("RECT"),x:tenthmil,y:tenthmil,width:tenthmil,height:tenthmil,lineWidth:external_exports2.number(),fillStyle:external_exports2.string(),rotation:external_exports2.number().optional()}),TextSchema=BaseShapeSchema.extend({type:external_exports2.literal("TEXT"),text:external_exports2.string(),x:tenthmil,y:tenthmil,size_mm:external_exports2.number(),rotation:external_exports2.number().optional(),layer:external_exports2.number().optional(),textAnchor:external_exports2.enum(["L","C","R",""]).optional().transform(val=>val===""?void 0:val),font:external_exports2.string().optional()}),PackageDetailShapeSchema=external_exports2.discriminatedUnion("type",[TrackSchema,PadSchema,ArcSchema,CircleSchema,SolidRegionSchema,SVGNodeSchema,HoleSchema,ViaSchema,RectSchema,TextSchema]),pairs3=arr=>{let pairs22=[];for(let i3=0;i3<arr.length;i3+=2)pairs22.push([arr[i3],arr[i3+1]]);return pairs22},parsePoints=pointsStr=>pairs3(pointsStr.trim().split(" ").map(n4=>Number(n4))),ShapeItemSchema=external_exports2.object({type:external_exports2.string(),data:external_exports2.string()}).transform(shape=>{switch(shape.type){case"TRACK":{let[width,layer,_4,pointsStr,id2,_n3]=shape.data.split("~"),points=parsePoints(pointsStr);return TrackSchema.parse({type:"TRACK",width,layer,points,id:id2})}case"PAD":{let[padShape,...params]=shape.data.split("~"),[centerX,centerY,width,height,layermask,net,number,holeRadius,...rest]=params.map(p4=>Number.isNaN(Number(p4))?p4:Number(p4)),center2={x:centerX,y:centerY},points;(padShape==="RECT"||padShape==="POLYGON")&&(points=parsePoints(rest[0]));let r5=Number(rest[1]),rotation22=Number.isNaN(r5)?void 0:r5,padInputParams={type:"PAD",shape:padShape,center:center2,width,height,layermask,net,number,holeRadius,points,rotation:rotation22,plated:rest.includes("Y")};return PadSchema.parse(padInputParams)}case"ARC":{let[width,layer,,arcData]=shape.data.split("~"),match2=arcData.match(/M\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)\s*A\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)\s*([\d.-]+)(?:\s*,\s*|\s+)([\d.-]+)/);if(!match2)throw new Error(`Invalid arc data: ${arcData}`);let[,startX,startY,radiusX,radiusY,xAxisRotation,largeArcFlag,sweepFlag,endX,endY]=match2,start=[Number(startX),Number(startY)],end=[Number(endX),Number(endY)];return ArcSchema.parse({type:"ARC",width:Number(width),layer:Number(layer),start,end,radiusX:Number(radiusX),radiusY:Number(radiusY),largeArc:largeArcFlag==="1",sweepDirection:sweepFlag==="1"?"CW":"CCW"})}case"CIRCLE":{let[centerX,centerY,radius,width,layer,id2]=shape.data.split("~"),center2=[Number(centerX),Number(centerY)];return CircleSchema.parse({type:"CIRCLE",center:center2,radius:Number(radius),width:Number(width),layer:Number(layer),id:id2})}case"HOLE":{let[centerX,centerY,radius,id2]=shape.data.split("~"),center2=[Number(centerX),Number(centerY)];return HoleSchema.parse({type:"HOLE",center:center2,radius:Number(radius),id:id2})}case"VIA":{let[x4,y4,outerDiameter,,holeDiameter,id2]=shape.data.split("~"),center2=[Number(x4),Number(y4)];return ViaSchema.parse({type:"VIA",center:center2,outerDiameter:Number(outerDiameter),holeDiameter:Number(holeDiameter),id:id2})}case"SOLIDREGION":{let[layermask,,pathData,fillStyle,id2]=shape.data.split("~"),points=pathData.match(/[ML] ?(-?[\d.]+)[ ,](-?[\d.]+)/g)?.map(point23=>{let[,x4,y4]=point23.match(/[ML]? ?(-?[\d.]+)[ ,](-?[\d.]+)/)||[];return[Number(x4),Number(y4)]})||[];return SolidRegionSchema.parse({type:"SOLIDREGION",layermask:Number(layermask),points,fillStyle,id:id2})}case"SVGNODE":{let svgData=JSON.parse(shape.data);return SVGNodeSchema.parse({type:"SVGNODE",svgData})}case"RECT":{let[x4,y4,width,height,lineWidth,id2,rotation22,layer,fillStyle]=shape.data.split("~"),r5=rotation22?Number(rotation22):void 0;return RectSchema.parse({type:"RECT",x:x4,y:y4,width,height,lineWidth:Number(lineWidth),id:id2,rotation:Number.isNaN(r5)?void 0:r5,layer:layer?Number(layer):void 0,fillStyle:fillStyle||void 0})}case"TEXT":{let[textAnchor,x4,y4,size22,layer,id2,rotation22,,font,text]=shape.data.split("~"),r5=rotation22?Number(rotation22):void 0;return TextSchema.parse({type:"TEXT",text,x:x4,y:y4,size_mm:Number(size22)*2.54,layer:layer?Number(layer):void 0,id:id2,rotation:Number.isNaN(r5)?void 0:r5,textAnchor,font:font||void 0})}default:throw new Error(`Unknown shape type: ${shape.type}`)}}).pipe(PackageDetailShapeSchema),ShapesArraySchema=external_exports2.array(ShapeItemSchema),PointSchema2=external_exports2.object({x:external_exports2.number(),y:external_exports2.number()}),RectangleShapeOutputSchema=external_exports2.object({type:external_exports2.literal("RECTANGLE"),position:PointSchema2,width:external_exports2.number(),height:external_exports2.number(),color:external_exports2.string(),lineWidth:external_exports2.number(),id:external_exports2.string()}),parseRectangle=str=>{let[,x4,y4,,,width,height,color,lineWidth,,,id2]=str.split("~");return{type:"RECTANGLE",position:{x:Number(x4),y:Number(y4)},width:Number(width),height:Number(height),color,lineWidth:Number(lineWidth),id:id2}},RectangleShapeSchema=external_exports2.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema),EllipseShapeOutputSchema=external_exports2.object({type:external_exports2.literal("ELLIPSE"),center:PointSchema2,radiusX:external_exports2.number(),radiusY:external_exports2.number(),color:external_exports2.string(),lineWidth:external_exports2.number(),id:external_exports2.string()}),parseEllipse=str=>{let[,x4,y4,radiusX,radiusY,color,lineWidth,,,id2]=str.split("~");return{type:"ELLIPSE",center:{x:Number(x4),y:Number(y4)},radiusX:Number(radiusX),radiusY:Number(radiusY),color,lineWidth:Number(lineWidth),id:id2}},EllipseShapeSchema=external_exports2.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema),ArcShapeOutputSchema=external_exports2.object({type:external_exports2.literal("ARC"),start:PointSchema2,end:PointSchema2,radius:external_exports2.number(),sweepFlag:external_exports2.boolean(),color:external_exports2.string(),lineWidth:external_exports2.number(),id:external_exports2.string()}),parseArc=str=>{let[,pathData,color,lineWidth,,,id2]=str.split("~"),parts=pathData.split(" "),x12=Number(parts[1])||0,y12=Number(parts[2])||0,radius=Number(parts[4])||0,sweepFlag=parts[7]==="1",x22=Number(parts[8])||0,y22=Number(parts[9])||0,parsedLineWidth=Number(lineWidth),finalLineWidth=Number.isNaN(parsedLineWidth)?1:parsedLineWidth;return{type:"ARC",start:{x:x12,y:y12},end:{x:x22,y:y22},radius,sweepFlag,color:color||"#880000",lineWidth:finalLineWidth,id:id2||"gge1"}},ArcShapeSchema=external_exports2.string().startsWith("A~").transform(parseArc).pipe(ArcShapeOutputSchema),PinShapeOutputSchema=external_exports2.object({type:external_exports2.literal("PIN"),visibility:external_exports2.enum(["show","hide","none"]),pinNumber:external_exports2.union([external_exports2.string(),external_exports2.number()]),x:external_exports2.number(),y:external_exports2.number(),rotation:external_exports2.number(),id:external_exports2.string(),label:external_exports2.string(),labelColor:external_exports2.string(),path:external_exports2.string(),arrow:external_exports2.string()}),parsePin=pinString=>{let parts=pinString.split("~"),[,visibility,,pinNumber,x4,y4,rotation22,id2]=parts,nameMatch=pinString.match(/~([\w+#-]+)~(start|end)~/),label=nameMatch?nameMatch[1]:"";label.endsWith("+")&&(label=label.slice(0,-1)+"_POS"),label.endsWith("-")&&(label=label.slice(0,-1)+"_NEG"),label.endsWith("#")&&(label=label.slice(0,-1)),/^\+\d+(?:\.\d+)?V$/i.test(label)&&(label=`V${label.slice(1,-1)}`);let colorMatch=pinString.match(/#[0-9A-F]{6}/),labelColor=colorMatch?colorMatch[0]:"",pathMatch=pinString.match(/\^\^([^~]+)/),path=pathMatch?pathMatch[1]:"",arrowMatch=pinString.match(/\^\^0~(.+)$/),arrow=arrowMatch?arrowMatch[1]:"",r5=Number.parseFloat(rotation22);return{type:"PIN",visibility,id:id2,pinNumber:Number.isNaN(Number(pinNumber))?pinNumber:Number(pinNumber),x:Number.parseFloat(x4),y:Number.parseFloat(y4),rotation:Number.isNaN(r5)?0:r5,label,labelColor,path,arrow}},PinShapeSchema=external_exports2.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema),PolylineShapeOutputSchema=external_exports2.object({type:external_exports2.literal("POLYLINE"),points:external_exports2.array(PointSchema2),color:external_exports2.string(),lineWidth:external_exports2.number(),id:external_exports2.string()}),parsePoints2=pointsStr=>pointsStr.split(" ").reduce((acc,value,index)=>(index%2===0?acc.push({x:Number(value),y:0}):acc[acc.length-1].y=Number(value),acc),[]),parsePolyline=str=>{let[,...rest]=str.split("~"),[pointsStr,color,lineWidth,,,id2]=rest;return{type:"POLYLINE",points:parsePoints2(pointsStr),color,lineWidth:Number(lineWidth),id:id2}},PolylineShapeSchema=external_exports2.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema),PolygonShapeOutputSchema=external_exports2.object({type:external_exports2.literal("POLYGON"),points:external_exports2.array(PointSchema2),fillColor:external_exports2.string(),lineWidth:external_exports2.number(),lineColor:external_exports2.string(),id:external_exports2.string()}),parsePolygon2=str=>{let[,...rest]=str.split("~"),[pointsStr,fillColor,lineWidth,lineColor,,id2]=rest;return{type:"POLYGON",points:parsePoints2(pointsStr),fillColor,lineWidth:Number(lineWidth),lineColor,id:id2}},PolygonShapeSchema=external_exports2.string().startsWith("PG~").transform(parsePolygon2).pipe(PolygonShapeOutputSchema),PathShapeOutputSchema=external_exports2.object({type:external_exports2.literal("PATH"),pathData:external_exports2.string(),fillColor:external_exports2.string(),strokeWidth:external_exports2.number(),strokeColor:external_exports2.string(),id:external_exports2.string()}),parsePath=str=>{let[,pathData,fillColor,strokeWidth,strokeColor,,id2]=str.split("~");return{type:"PATH",pathData,fillColor,strokeWidth:mil10ToMm(Number(strokeWidth)),strokeColor,id:id2}},PathShapeSchema=external_exports2.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema),optionalEasyEdaTextField=fieldSchema=>external_exports2.preprocess(textField=>{if(!(textField==null||textField===""||textField==="undefined"))return textField},fieldSchema),TextShapeOutputSchema=external_exports2.object({type:external_exports2.literal("TEXT"),alignment:external_exports2.enum(["L","C","R"]),x:external_exports2.number(),y:external_exports2.number(),rotation:external_exports2.number(),fontColor:external_exports2.string(),backgroundColor:optionalEasyEdaTextField(external_exports2.string().optional()),fontSize:external_exports2.string(),fontWeight:optionalEasyEdaTextField(external_exports2.string().optional().default("normal")),fontStyle:optionalEasyEdaTextField(external_exports2.enum(["normal","italic"]).optional().default("normal")),fontDecoration:optionalEasyEdaTextField(external_exports2.string().optional().default("")),content:external_exports2.string(),textType:external_exports2.string(),visibility:external_exports2.enum(["0","1"]),mirror:external_exports2.string(),id:external_exports2.string()}),parseText=str=>{let[,alignment,x4,y4,rotation22,fontColor,backgroundColor,fontSize,fontWeight,fontStyle,fontDecoration,content,textType,visibility,mirror,id2]=str.split("~");return{type:"TEXT",alignment,x:Number(x4),y:Number(y4),rotation:Number(rotation22),fontColor,backgroundColor,fontSize,fontWeight,fontStyle,fontDecoration,content,textType,visibility,mirror,id:id2}},TextShapeSchema=external_exports2.string().startsWith("T~").transform(parseText).pipe(TextShapeOutputSchema),SingleLetterShapeSchema=external_exports2.string().transform(x4=>{if(x4.startsWith("R~"))return RectangleShapeSchema.parse(x4);if(x4.startsWith("E~"))return EllipseShapeSchema.parse(x4);if(x4.startsWith("P~"))return PinShapeSchema.parse(x4);if(x4.startsWith("PL~"))return PolylineShapeSchema.parse(x4);if(x4.startsWith("PG~"))return PolygonShapeSchema.parse(x4);if(x4.startsWith("PT~"))return PathShapeSchema.parse(x4);if(x4.startsWith("T~"))return TextShapeSchema.parse(x4);if(x4.startsWith("A~"))return ArcShapeSchema.parse(x4);throw new Error(`Invalid shape type: ${x4}`)}).pipe(external_exports2.union([RectangleShapeOutputSchema,EllipseShapeOutputSchema,PinShapeOutputSchema,PolylineShapeOutputSchema,PolygonShapeOutputSchema,PathShapeOutputSchema,TextShapeOutputSchema,ArcShapeOutputSchema])),maybeNumber=external_exports2.any().transform(k4=>k4==="nan"||Number.isNaN(k4)?null:k4).pipe(external_exports2.number().nullable().optional()),SzlcscSchema=external_exports2.object({id:external_exports2.number(),number:external_exports2.string(),step:external_exports2.number().optional(),min:external_exports2.number().optional(),price:external_exports2.number().optional(),stock:external_exports2.number().optional(),url:external_exports2.string().url().optional(),image:external_exports2.string().optional().optional()}),LcscSchema=external_exports2.object({id:external_exports2.number(),number:external_exports2.string(),step:external_exports2.number().optional(),min:external_exports2.number().optional(),price:external_exports2.number().optional(),stock:external_exports2.number().optional(),url:external_exports2.string().url().optional()}),OwnerSchema=external_exports2.object({uuid:external_exports2.string(),username:external_exports2.string(),nickname:external_exports2.string(),avatar:external_exports2.string()}),HeadSchema=external_exports2.object({docType:external_exports2.preprocess(val=>val==null?val:String(val),external_exports2.string()),editorVersion:external_exports2.string(),c_para:external_exports2.record(external_exports2.string(),external_exports2.string().nullable()),x:external_exports2.number(),y:external_exports2.number(),puuid:external_exports2.string().optional(),uuid:external_exports2.string(),utime:external_exports2.preprocess(val=>val===""?0:typeof val=="string"?Number(val):val,external_exports2.number()),importFlag:external_exports2.number().optional(),c_spiceCmd:external_exports2.any().optional(),hasIdFlag:external_exports2.boolean()}),BBoxSchema=external_exports2.object({x:external_exports2.number(),y:external_exports2.number(),width:external_exports2.number(),height:external_exports2.number()}),LayerItemSchema=external_exports2.object({name:external_exports2.string(),color:external_exports2.string(),visible:external_exports2.boolean(),active:external_exports2.boolean(),config:external_exports2.boolean(),transparency:external_exports2.boolean()}),ObjectItemSchema=external_exports2.object({name:external_exports2.string(),visible:external_exports2.boolean(),locked:external_exports2.boolean()}),DataStrSchema=external_exports2.object({head:HeadSchema,canvas:external_exports2.string(),shape:external_exports2.array(SingleLetterShapeSchema),BBox:BBoxSchema,colors:external_exports2.union([external_exports2.array(external_exports2.string()),external_exports2.record(external_exports2.string())])}),PackageDetailDataStrSchema=external_exports2.object({head:HeadSchema,canvas:external_exports2.string(),shape:external_exports2.array(external_exports2.string()).transform(shapes=>shapes.map(shape=>{let[type,...data]=shape.split("~");return ShapeItemSchema.parse({type,data:data.join("~")})})).pipe(external_exports2.array(PackageDetailShapeSchema)),layers:external_exports2.array(external_exports2.string()).transform(layers=>layers.map(layer=>{let[name,color,visible,active,config,transparency]=layer.split("~");return LayerItemSchema.parse({name,color,visible:visible==="true",active:active==="true",config:config==="true",transparency:transparency==="true"})})),objects:external_exports2.array(external_exports2.string()).transform(objects=>objects.map(obj=>{let[name,visible,locked]=obj.split("~");return ObjectItemSchema.parse({name,visible:visible==="true",locked:locked==="true"})})),BBox:BBoxSchema,netColors:external_exports2.array(external_exports2.unknown()).optional()}),PackageDetailSchema=external_exports2.object({uuid:external_exports2.string(),title:external_exports2.string(),docType:external_exports2.number(),updateTime:external_exports2.number(),owner:OwnerSchema,datastrid:external_exports2.string(),writable:external_exports2.boolean(),dataStr:PackageDetailDataStrSchema}),ModelBoundsSchema=external_exports2.object({min:external_exports2.object({x:external_exports2.number(),y:external_exports2.number(),z:external_exports2.number()}),max:external_exports2.object({x:external_exports2.number(),y:external_exports2.number(),z:external_exports2.number()})}),EasyEdaJsonSchema=external_exports2.object({uuid:external_exports2.string(),title:external_exports2.string(),description:external_exports2.string(),docType:external_exports2.number(),type:external_exports2.number(),szlcsc:SzlcscSchema,lcsc:LcscSchema,owner:OwnerSchema,tags:external_exports2.array(external_exports2.string()),category:external_exports2.string().optional(),updateTime:external_exports2.number(),updated_at:external_exports2.string(),dataStr:DataStrSchema,verify:external_exports2.boolean(),SMT:external_exports2.boolean().optional(),datastrid:external_exports2.string(),jlcOnSale:external_exports2.number().optional(),writable:external_exports2.boolean(),isFavorite:external_exports2.boolean(),packageDetail:PackageDetailSchema,_objMetadata:external_exports2.object({bounds:ModelBoundsSchema}).optional()}),getModelObjCdnUrl=({easyedaModelUuid,easyedaPartNumber})=>`https://modelcdn.tscircuit.com/easyeda_models/assets/${easyedaPartNumber}.obj?uuid=${easyedaModelUuid}`,getModelCdnUrl=getModelObjCdnUrl,getModelUuidFromRawPackageDetail=result=>{let shapes=result.packageDetail?.dataStr?.shape;if(!Array.isArray(shapes))return null;for(let shape of shapes){if(typeof shape!="string"||!shape.startsWith("SVGNODE~"))continue;let svgNodeJson=shape.slice(8);try{let modelUuid=JSON.parse(svgNodeJson)?.attrs?.uuid;if(typeof modelUuid=="string"&&modelUuid.length>0)return modelUuid}catch{}}return null},parseObjBounds2=objText=>{let minX=Number.POSITIVE_INFINITY,minY=Number.POSITIVE_INFINITY,minZ=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY,maxZ=Number.NEGATIVE_INFINITY,vertexCount=0;for(let line2 of objText.split(/\r?\n/)){let trimmed=line2.trim();if(!trimmed.startsWith("v "))continue;let[,xStr,yStr,zStr]=trimmed.split(/\s+/,4),x4=Number(xStr),y4=Number(yStr),z4=Number(zStr);!Number.isFinite(x4)||!Number.isFinite(y4)||!Number.isFinite(z4)||(vertexCount+=1,minX=Math.min(minX,x4),minY=Math.min(minY,y4),minZ=Math.min(minZ,z4),maxX=Math.max(maxX,x4),maxY=Math.max(maxY,y4),maxZ=Math.max(maxZ,z4))}return vertexCount===0?null:{min:{x:minX,y:minY,z:minZ},max:{x:maxX,y:maxY,z:maxZ}}};async function fetchEasyEDAComponent(jlcpcbPartNumber,{fetch:fetch22=globalThis.fetch,includeModelMetadata=!0}={}){let searchUrl="https://easyeda.com/api/components/search",componentUrl=uuid=>`https://easyeda.com/api/components/${uuid}?version=6.4.7&uuid=${uuid}&datastrid=`,searchHeaders={authority:"easyeda.com",pragma:"no-cache","cache-control":"no-cache",accept:"application/json, text/javascript, */*; q=0.01","x-requested-with":"XMLHttpRequest","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36","content-type":"application/x-www-form-urlencoded; charset=UTF-8",origin:"https://easyeda.com","sec-fetch-site":"same-origin","sec-fetch-mode":"cors","sec-fetch-dest":"empty",referer:"https://easyeda.com/editor","accept-language":"cs,en;q=0.9,sk;q=0.8,en-GB;q=0.7",cookie:"<PUT your cookies here>"},searchData=`type=3&doctype%5B%5D=2&uid=0819f05c4eef4c71ace90d822a990e87&returnListStyle=classifyarr&wd=${jlcpcbPartNumber}&version=6.4.7`,searchResponse=await fetch22(searchUrl,{method:"POST",headers:searchHeaders,body:searchData});if(!searchResponse.ok)throw new Error("Failed to search for the component");let searchResult=await searchResponse.json();if(!searchResult.success||!searchResult.result.lists.lcsc.length)throw new Error("Component not found");let componentUUID=(searchResult.result.lists.lcsc.find(component=>component.dataStr.head.c_para["Supplier Part"]===jlcpcbPartNumber)??searchResult.result.lists.lcsc[0]).uuid,componentResponse=await fetch22(componentUrl(componentUUID),{method:"GET",headers:{...searchHeaders,referer:`https://easyeda.com/editor?uuid=${componentUUID}`}});if(!componentResponse.ok)throw new Error("Failed to fetch the component details");let result=(await componentResponse.json()).result;if(includeModelMetadata){let modelUuid=getModelUuidFromRawPackageDetail(result),partNumber=result.lcsc?.number;if(modelUuid&&partNumber)try{let objUrl=getModelCdnUrl({easyedaModelUuid:modelUuid,easyedaPartNumber:partNumber}),objResponse=await fetch22(objUrl);if(objResponse.ok){let objText=await objResponse.text(),bounds=parseObjBounds2(objText);bounds&&(result._objMetadata={bounds})}}catch(error2){console.error(`Error fetching model metadata for ${jlcpcbPartNumber}:`,error2)}}return result}var getFootprinterStringFromKicad=kicadFootprint=>{let match2=kicadFootprint.match(/:[RC]_(\d{4})_/);if(match2||(match2=kicadFootprint.match(/:(SOIC-\d+|SOT-\d+|SOD-\d+|SSOP-\d+|TSSOP-\d+|QFP-\d+|QFN-\d+)/),match2))return match2[1]},getJlcPackageFromFootprinterString=footprinterString=>footprinterString.includes("cap")?footprinterString.replace(/cap/g,""):footprinterString,getJlcpcbPackageName=footprint=>{if(footprint){if(footprint.startsWith("kicad:")){let footprinterString=getFootprinterStringFromKicad(footprint);return footprinterString?getJlcPackageFromFootprinterString(footprinterString):footprint}return getJlcPackageFromFootprinterString(footprint)}},EASYEDA_API_ORIGIN="https://easyeda.com",METHODS_WITHOUT_BODY=new Set(["GET","HEAD"]),getRequestUrl=requestInput=>typeof requestInput=="string"?requestInput:requestInput instanceof URL?requestInput.toString():requestInput.url,createMergedTargetRequest=(requestInput,requestInit)=>requestInput instanceof URL?new Request(requestInput.toString(),requestInit):typeof requestInput=="string"?new Request(requestInput,requestInit):new Request(requestInput,requestInit),isEasyEdaApiRequestUrl=requestUrl=>requestUrl.startsWith(`${EASYEDA_API_ORIGIN}/api/`),getFetchWithEasyEdaProxy=({platformFetch:upstreamFetch,easyEdaProxyConfig})=>async(requestInput,requestInit)=>{let targetRequestUrl=getRequestUrl(requestInput);if(!isEasyEdaApiRequestUrl(targetRequestUrl))return upstreamFetch(requestInput,requestInit);let mergedTargetRequest=createMergedTargetRequest(requestInput,requestInit),targetRequestHeaders=new Headers(mergedTargetRequest.headers),proxyRequestHeaders=new Headers(targetRequestHeaders);proxyRequestHeaders.delete("origin"),proxyRequestHeaders.delete("authority"),proxyRequestHeaders.delete("host"),proxyRequestHeaders.delete("referer"),proxyRequestHeaders.delete("user-agent"),proxyRequestHeaders.delete("cookie"),proxyRequestHeaders.set("X-Target-Url",targetRequestUrl),proxyRequestHeaders.set("X-Sender-Origin",targetRequestHeaders.get("origin")??""),proxyRequestHeaders.set("X-Sender-Host",targetRequestHeaders.get("host")??EASYEDA_API_ORIGIN),proxyRequestHeaders.set("X-Sender-Referer",targetRequestHeaders.get("referer")??""),proxyRequestHeaders.set("X-Sender-User-Agent",targetRequestHeaders.get("user-agent")??""),proxyRequestHeaders.set("X-Sender-Cookie",targetRequestHeaders.get("cookie")??""),proxyRequestHeaders.set("authority",targetRequestHeaders.get("authority")??targetRequestHeaders.get("host")??""),proxyRequestHeaders.set("content-type",targetRequestHeaders.get("content-type")??"");for(let[name,value]of Object.entries(easyEdaProxyConfig.headers??{}))proxyRequestHeaders.set(name,value);let proxyRequestBody=METHODS_WITHOUT_BODY.has(mergedTargetRequest.method)?void 0:await mergedTargetRequest.clone().arrayBuffer();return upstreamFetch(easyEdaProxyConfig.proxyEndpointUrl,{method:mergedTargetRequest.method,headers:proxyRequestHeaders,body:proxyRequestBody,signal:requestInit?.signal})},cache=new Map,getJlcPartsCached=async(name,params)=>{let paramString=new URLSearchParams({...params,json:"true"}).toString();if(cache.has(paramString))return cache.get(paramString);let responseJson=await(await fetch(`https://jlcsearch.tscircuit.com/${name}/list?${paramString}`)).json();return cache.set(paramString,responseJson),responseJson},withBasicPartPreference=parts=>parts?[...parts].sort((a3,b3)=>Number(b3.is_basic??!1)-Number(a3.is_basic??!1)):[],JlcPcbPartsEngine=class{constructor({platformFetch:defaultPlatformFetch,easyEdaProxyConfig}={}){__publicField(this,"defaultPlatformFetch");__publicField(this,"easyEdaProxyConfig");this.defaultPlatformFetch=defaultPlatformFetch,this.easyEdaProxyConfig=easyEdaProxyConfig,this.fetchPartCircuitJson=this.fetchPartCircuitJson.bind(this)}getEasyEdaPlatformFetch(platformFetchOverride){let resolvedPlatformFetch=platformFetchOverride??this.defaultPlatformFetch??globalThis.fetch;return this.easyEdaProxyConfig?getFetchWithEasyEdaProxy({platformFetch:resolvedPlatformFetch,easyEdaProxyConfig:this.easyEdaProxyConfig}):resolvedPlatformFetch}async findPart({sourceComponent,footprinterString}){let jlcpcbPackage=getJlcpcbPackageName(footprinterString);if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_resistor"){let{resistors}=await getJlcPartsCached("resistors",{resistance:sourceComponent.resistance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(resistors).map(r5=>`C${r5.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_capacitor"){let{capacitors}=await getJlcPartsCached("capacitors",{capacitance:sourceComponent.capacitance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(capacitors).map(c4=>`C${c4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_pin_header"){let pitch;footprinterString?.includes("_p")&&(pitch=Number(footprinterString.split("_p")[1]));let{headers}=await getJlcPartsCached("headers",pitch?{pitch,num_pins:sourceComponent.pin_count,gender:sourceComponent.gender}:{num_pins:sourceComponent.pin_count,gender:sourceComponent.gender});return{jlcpcb:withBasicPartPreference(headers).map(h6=>`C${h6.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_potentiometer"){let{potentiometers}=await getJlcPartsCached("potentiometers",{resistance:sourceComponent.max_resistance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(potentiometers).map(p4=>`C${p4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_diode"){let{diodes}=await getJlcPartsCached("diodes",{package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(diodes).map(d4=>`C${d4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_chip"){if(!jlcpcbPackage||!footprinterString)return{};let{chips}=await getJlcPartsCached("chips",{package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(chips).map(c4=>`C${c4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_transistor"){let{transistors}=await getJlcPartsCached("transistors",{package:jlcpcbPackage,transistor_type:sourceComponent.transistor_type});return{jlcpcb:withBasicPartPreference(transistors).map(t52=>`C${t52.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_power_source"){let{power_sources}=await getJlcPartsCached("power_sources",{voltage:sourceComponent.voltage,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(power_sources).map(p4=>`C${p4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_inductor"){let{inductors}=await getJlcPartsCached("inductors",{inductance:sourceComponent.inductance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(inductors).map(i3=>`C${i3.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_crystal"){let{crystals}=await getJlcPartsCached("crystals",{frequency:sourceComponent.frequency,load_capacitance:sourceComponent.load_capacitance,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(crystals).map(c4=>`C${c4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_mosfet"){let{mosfets}=await getJlcPartsCached("mosfets",{package:jlcpcbPackage,mosfet_mode:sourceComponent.mosfet_mode,channel_type:sourceComponent.channel_type});return{jlcpcb:withBasicPartPreference(mosfets).map(m4=>`C${m4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_resonator"){let{resonators}=await getJlcPartsCached("resonators",{frequency:sourceComponent.frequency,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(resonators).map(r5=>`C${r5.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_switch"){let{switches}=await getJlcPartsCached("switches",{switch_type:sourceComponent.type,package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(switches).map(s3=>`C${s3.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_led"){let{leds}=await getJlcPartsCached("leds",{package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(leds).map(l4=>`C${l4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_fuse"){let{fuses}=await getJlcPartsCached("fuses",{package:jlcpcbPackage});return{jlcpcb:withBasicPartPreference(fuses).map(l4=>`C${l4.lcsc}`).slice(0,3)}}else if(sourceComponent.type==="source_component"&&sourceComponent.ftype==="simple_connector"&&sourceComponent.standard==="usb_c"){let{usb_c_connectors}=await getJlcPartsCached("usb_c_connectors",{});return{jlcpcb:withBasicPartPreference(usb_c_connectors).map(c4=>`C${c4.lcsc}`).slice(0,3)}}return{}}async fetchPartCircuitJson({supplierPartNumber,manufacturerPartNumber,platformFetch:platformFetchOverride}){let easyEdaPlatformFetch=this.getEasyEdaPlatformFetch(platformFetchOverride),resolvedSupplierPartNumber=supplierPartNumber;if(!resolvedSupplierPartNumber&&manufacturerPartNumber){let{components}=await getJlcPartsCached("components",{search:manufacturerPartNumber});resolvedSupplierPartNumber=components?.[0]?`C${components[0].lcsc}`:void 0}if(!resolvedSupplierPartNumber)return;let rawEasyEdaJson=await fetchEasyEDAComponent(resolvedSupplierPartNumber,{fetch:easyEdaPlatformFetch}),parsed=EasyEdaJsonSchema.parse(rawEasyEdaJson);return convertEasyEdaJsonToCircuitJson(parsed)}},jlcPartsEngine=new JlcPcbPartsEngine;var gridRouter=__toESM(require_grid_router(),1);async function initKiCadRoutingToolsAutorouter(){}var KiCadRoutingToolsAutorouter=class{constructor(input2,options={}){__publicField(this,"input");__publicField(this,"options");__publicField(this,"isRouting",!1);__publicField(this,"cachedTraces",null);__publicField(this,"completeHandlers",[]);__publicField(this,"errorHandlers",[]);__publicField(this,"progressHandlers",[]);this.input=input2,this.options=options}on(event,callback){if(event==="complete"){this.completeHandlers.push(callback);return}if(event==="error"){this.errorHandlers.push(callback);return}this.progressHandlers.push(callback)}start(){this.isRouting||(this.isRouting=!0,this.emitProgress(0,"initializing KiCadRoutingTools wasm router"),this.solve().then(traces=>{this.isRouting&&(this.isRouting=!1,this.emitProgress(1,"routing complete"),this.emitComplete(traces))},error2=>{this.isRouting=!1,this.emitError(error2)}))}stop(){this.isRouting=!1}async solve(){return this.cachedTraces?this.cachedTraces:(await initKiCadRoutingToolsAutorouter(),this.cachedTraces=this.solveSync(),this.cachedTraces)}solveSync(){return this.cachedTraces??(this.cachedTraces=gridRouter.routeSimpleRouteJson(this.input,normalizeOptions(this.options))),(this.options.collapseShortSameLayerTunnels??!0)&&(this.cachedTraces=collapseShortSameLayerTunnels(this.cachedTraces)),this.cachedTraces}emitComplete(traces){for(let handler of this.completeHandlers)handler({type:"complete",traces})}emitError(error2){let normalizedError=error2 instanceof Error?error2:new Error(String(error2));for(let handler of this.errorHandlers)handler({type:"error",error:normalizedError})}emitProgress(progress,phase){for(let handler of this.progressHandlers)handler({type:"progress",steps:Math.round(progress*this.input.connections.length),progress,phase})}};function createKiCadRoutingToolsAutorouter(options={}){return async simpleRouteJson=>(await initKiCadRoutingToolsAutorouter(),new KiCadRoutingToolsAutorouter(simpleRouteJson,options))}function normalizeOptions(options){return{gridStep:options.gridStep??.1,clearance:options.clearance??.2,maxIterations:options.maxIterations??3e5,viaCost:options.viaCost??5e4,hWeight:options.hWeight??1.25,turnCost:options.turnCost??1e3,trackMargin:options.trackMargin??0,layerCosts:options.layerCosts,layerDirectionPreferences:options.layerDirectionPreferences,directionPreferenceCost:options.directionPreferenceCost??0}}function collapseShortSameLayerTunnels(traces){return traces.map(trace=>({...trace,route:collapseTraceRoute(trace.route??[],1)}))}function collapseTraceRoute(route,maxTunnelLength){let collapsed=[],index=0;for(;index<route.length;){let replacement=getShortTunnelReplacement(route.slice(index),maxTunnelLength);if(replacement){collapsed.push(replacement),index+=6;continue}collapsed.push(route[index]),index+=1}return collapsed}function getShortTunnelReplacement(route,maxTunnelLength){let[start,viaIn,innerStart,innerEnd,viaOut,end]=route;return start?.route_type!=="wire"||viaIn?.route_type!=="via"||innerStart?.route_type!=="wire"||innerEnd?.route_type!=="wire"||viaOut?.route_type!=="via"||end?.route_type!=="wire"||start.layer!==viaIn.from_layer||viaIn.to_layer!==innerStart.layer||innerStart.layer!==innerEnd.layer||viaOut.from_layer!==innerStart.layer||viaOut.to_layer!==start.layer||end.layer!==start.layer||!samePoint(start,viaIn)||!samePoint(start,innerStart)||!samePoint(innerEnd,viaOut)||!samePoint(innerEnd,end)||Math.hypot(end.x-start.x,end.y-start.y)>maxTunnelLength?null:{route_type:"wire",x:end.x,y:end.y,layer:start.layer,width:start.width}}function samePoint(a3,b3){return Math.abs(a3.x-b3.x)<1e-6&&Math.abs(a3.y-b3.y)<1e-6}var import_s_expression=__toESM(require_s_expression(),1);init_zod();var import_debug20=__toESM(require_browser(),1),import_debug21=__toESM(require_browser(),1),point22=external_exports.tuple([external_exports.coerce.number(),external_exports.coerce.number()]),point34=external_exports.tuple([external_exports.number(),external_exports.number(),external_exports.number()]),point6=external_exports.union([point22,point34]),fp_poly_arc_segment_def=external_exports.object({kind:external_exports.literal("arc"),start:point22,mid:point22,end:point22}),fp_poly_point_def=external_exports.union([point22,fp_poly_arc_segment_def]),attributes_def=external_exports.object({at:point6,size:point22,layer:external_exports.string(),layers:external_exports.array(external_exports.string()),roundrect_rratio:external_exports.number(),uuid:external_exports.string()}).partial(),property_def=external_exports.object({key:external_exports.string(),val:external_exports.string(),attributes:attributes_def}),drill_def=external_exports.object({oval:external_exports.boolean().default(!1),width:external_exports.number().optional(),height:external_exports.number().optional(),offset:point22.optional()}),hole_def=external_exports.object({name:external_exports.string(),pad_type:external_exports.enum(["thru_hole","smd","np_thru_hole","connect"]),pad_shape:external_exports.enum(["roundrect","circle","rect","oval","trapezoid","custom"]),at:point6,drill:external_exports.union([external_exports.number(),external_exports.array(external_exports.any()),drill_def]).transform(a3=>typeof a3=="number"?{oval:!1,width:a3,height:a3}:"oval"in a3?a3:a3.length===2?{oval:!1,width:Number.parseFloat(a3[0]),height:Number.parseFloat(a3[0]),offset:point22.parse(a3[1].slice(1))}:a3.length===3||a3.length===4?{oval:a3[0]==="oval",width:Number.parseFloat(a3[1]),height:Number.parseFloat(a3[2]),offset:a3[3]?point22.parse(a3[3].slice(1)):void 0}:a3).pipe(drill_def),size:external_exports.union([external_exports.array(external_exports.number()).length(2).transform(([w4,h6])=>({width:w4,height:h6})),external_exports.object({width:external_exports.number(),height:external_exports.number()})]),layers:external_exports.array(external_exports.string()).optional(),roundrect_rratio:external_exports.number().optional(),uuid:external_exports.string().optional()}),pad_def2=external_exports.object({name:external_exports.string(),pad_type:external_exports.enum(["thru_hole","smd","np_thru_hole","connect"]),pad_shape:external_exports.enum(["roundrect","circle","rect","oval","trapezoid","custom"]),at:point6,size:point22,drill:external_exports.union([external_exports.number(),external_exports.array(external_exports.any()),drill_def]).transform(a3=>typeof a3=="number"?{oval:!1,width:a3,height:a3}:"oval"in a3?a3:a3.length===2?{oval:!1,width:Number.parseFloat(a3[0]),height:Number.parseFloat(a3[0]),offset:point22.parse(a3[1].slice(1))}:a3.length===3||a3.length===4?{oval:a3[0]==="oval",width:Number.parseFloat(a3[1]),height:Number.parseFloat(a3[2]),offset:a3[3]?point22.parse(a3[3].slice(1)):void 0}:a3).pipe(drill_def).optional(),layers:external_exports.array(external_exports.string()).optional(),roundrect_rratio:external_exports.number().optional(),chamfer_ratio:external_exports.number().optional(),solder_paste_margin:external_exports.number().optional(),solder_paste_margin_ratio:external_exports.number().optional(),clearance:external_exports.number().optional(),zone_connection:external_exports.union([external_exports.literal(0).describe("Pad is not connect to zone"),external_exports.literal(1).describe("Pad is connected to zone using thermal relief"),external_exports.literal(2).describe("Pad is connected to zone using solid fill")]).optional(),thermal_width:external_exports.number().optional(),thermal_gap:external_exports.number().optional(),uuid:external_exports.string().optional()}),effects_def=external_exports.object({font:external_exports.object({size:point22,thickness:external_exports.number().optional()})}).partial(),fp_text_def=external_exports.object({fp_text_type:external_exports.literal("user"),text:external_exports.string(),at:point6,layer:external_exports.string(),uuid:external_exports.string().optional(),effects:effects_def.partial()}),fp_arc_def=external_exports.object({start:point22,mid:point22,end:point22,stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}),layer:external_exports.string(),uuid:external_exports.string().optional()}),fp_circle_def=external_exports.object({center:point22,end:point22,stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}),fill:external_exports.string().optional(),layer:external_exports.string(),uuid:external_exports.string().optional()}),fp_poly_def=external_exports.object({pts:external_exports.array(fp_poly_point_def),stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}).optional(),width:external_exports.number().optional(),layer:external_exports.string(),uuid:external_exports.string().optional(),fill:external_exports.string().optional()}).transform(data=>({...data,width:void 0,stroke:data.stroke??{width:data.width}})),fp_rect_def=external_exports.object({start:point22,end:point22,stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}).optional(),width:external_exports.number().optional(),fill:external_exports.string().optional(),layer:external_exports.string(),uuid:external_exports.string().optional()}).transform(data=>({...data,width:void 0,stroke:data.stroke??{width:data.width}})),fp_line=external_exports.object({start:point22,end:point22,stroke:external_exports.object({width:external_exports.number(),type:external_exports.string()}).optional(),width:external_exports.number().optional(),layer:external_exports.string(),uuid:external_exports.string().optional()}).transform(data=>({...data,width:void 0,stroke:data.stroke??{width:data.width}})),kicad_mod_json_def=external_exports.object({footprint_name:external_exports.string(),version:external_exports.string().optional(),generator:external_exports.string().optional(),generator_version:external_exports.string().optional(),layer:external_exports.string(),descr:external_exports.string().default(""),tags:external_exports.array(external_exports.string()).optional(),properties:external_exports.array(property_def),fp_lines:external_exports.array(fp_line),fp_rects:external_exports.array(fp_rect_def).optional(),fp_texts:external_exports.array(fp_text_def),fp_arcs:external_exports.array(fp_arc_def),fp_circles:external_exports.array(fp_circle_def).optional(),fp_polys:external_exports.array(fp_poly_def).optional(),pads:external_exports.array(pad_def2),holes:external_exports.array(hole_def).optional()}),formatAttr=(val,attrKey)=>{if(attrKey==="effects"&&Array.isArray(val)){let effectsObj={};for(let elm of val)if(elm[0]==="font"){let fontObj={};for(let fontElm of elm.slice(1))fontElm.length===2?fontObj[fontElm[0].valueOf()]=Number.parseFloat(fontElm[1].valueOf()):fontObj[fontElm[0].valueOf()]=fontElm.slice(1).map(n4=>Number.parseFloat(n4.valueOf()));effectsObj.font=fontObj}return effects_def.parse(effectsObj)}if(attrKey==="pts")return val.map(segment2=>{let segmentType=segment2[0]?.valueOf?.()??segment2[0];if(segmentType==="xy")return segment2.slice(1).map(n4=>Number.parseFloat(n4.valueOf()));if(segmentType==="arc"){let arcObj={kind:"arc"};for(let arcAttr of segment2.slice(1)){let key=arcAttr[0].valueOf();arcObj[key]=arcAttr.slice(1).map(n4=>Number.parseFloat(n4.valueOf()))}return arcObj}return segment2});if(attrKey==="stroke"){let strokeObj={};for(let strokeElm of val){let strokePropKey=strokeElm[0].valueOf();strokeObj[strokePropKey]=formatAttr(strokeElm.slice(1),strokePropKey)}return strokeObj}return attrKey==="at"||attrKey==="size"||attrKey==="start"||attrKey==="mid"||attrKey==="end"?(Array.isArray(val)?val:[val]).map(n4=>n4?.valueOf?.()??n4).filter(v4=>typeof v4=="number"||typeof v4=="string"&&/^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(v4)).map(v4=>typeof v4=="number"?v4:Number.parseFloat(v4)):attrKey==="tags"?val.map(n4=>n4.valueOf()):attrKey==="generator_version"||attrKey==="version"?val[0].valueOf():val.length===2?val.valueOf():attrKey==="uuid"?Array.isArray(val)?val[0].valueOf():val.valueOf():/^[\d\.]+$/.test(val)&&!Number.isNaN(Number.parseFloat(val))?Number.parseFloat(val):Array.isArray(val)&&val.length===1?val[0].valueOf():Array.isArray(val)?val.map(s3=>s3.valueOf()):val},getAttr=(s3,key)=>{for(let elm of s3)if(Array.isArray(elm)&&elm[0]===key)return formatAttr(elm.slice(1),key)},debug11=(0,import_debug20.default)("kicad-mod-converter"),parseKicadModToKicadJson=fileContent=>{let kicadSExpr=(0,import_s_expression.default)(fileContent),footprintName=kicadSExpr[1].valueOf(),topLevelAttributes={},simpleTopLevelAttributes=Object.entries(kicad_mod_json_def.shape).filter(([attributeKey,def])=>def._def.typeName==="ZodString"||attributeKey==="tags").map(([attributeKey])=>attributeKey);for(let kicadSExprRow of kicadSExpr.slice(2)){if(!simpleTopLevelAttributes.includes(kicadSExprRow[0]))continue;let key=kicadSExprRow[0].valueOf(),val=formatAttr(kicadSExprRow.slice(1),key);topLevelAttributes[key]=val}let properties=kicadSExpr.slice(2).filter(row=>row[0]==="property").map(row=>{let key=row[1].valueOf(),val=row[2].valueOf(),attributes2=attributes_def.parse(row.slice(3).reduce((acc,attrAr)=>{let attrKey=attrAr[0].valueOf();return acc[attrKey]=formatAttr(attrAr.slice(1),attrKey),acc},{}));return{key,val,attributes:attributes2}}),padRows=kicadSExpr.slice(2).filter(row=>row[0]==="pad"),pads=[];for(let row of padRows){let at3=getAttr(row,"at"),size3=getAttr(row,"size"),drill=getAttr(row,"drill"),layers=getAttr(row,"layers");Array.isArray(layers)?layers=layers.map(layer=>layer.valueOf()):typeof layers=="string"?layers=[layers]:layers||(layers=[]);let padType=row[2].valueOf(),isCu=layers.some(l4=>l4.endsWith(".Cu")||l4==="*.Cu"||l4.includes(".Cu"));if(padType==="thru_hole")continue;if(!isCu&&padType!=="np_thru_hole"){debug11(`Skipping pad without copper layer: layers=${layers.join(", ")}`);continue}let roundrect_rratio=getAttr(row,"roundrect_rratio"),uuid=getAttr(row,"uuid"),padRaw={name:row[1].valueOf(),pad_type:row[2].valueOf(),pad_shape:row[3].valueOf(),at:at3,drill,size:size3,layers,roundrect_rratio,uuid};debug11(`attempting to parse pad: ${JSON.stringify(padRaw,null," ")}`),pads.push(pad_def2.parse(padRaw))}let fp_texts_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_text"),fp_texts=[];for(let fp_text_row of fp_texts_rows){let text=fp_text_row[2].valueOf(),at3=getAttr(fp_text_row,"at"),layer=getAttr(fp_text_row,"layer"),uuid=getAttr(fp_text_row,"uuid"),effects=getAttr(fp_text_row,"effects");fp_texts.push({fp_text_type:"user",text,at:at3,layer,uuid,effects})}let fp_lines=[],fp_lines_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_line");for(let fp_line_row of fp_lines_rows){let start=getAttr(fp_line_row,"start"),end=getAttr(fp_line_row,"end"),stroke=getAttr(fp_line_row,"stroke"),layer=getAttr(fp_line_row,"layer"),uuid=getAttr(fp_line_row,"uuid");fp_lines.push({start,end,stroke,layer,uuid})}let fp_rects=[],fp_rect_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_rect");for(let fp_rect_row of fp_rect_rows){let start=getAttr(fp_rect_row,"start"),end=getAttr(fp_rect_row,"end"),stroke=getAttr(fp_rect_row,"stroke"),layer=getAttr(fp_rect_row,"layer"),fill=getAttr(fp_rect_row,"fill"),uuid=getAttr(fp_rect_row,"uuid");!start||!end||!layer||fp_rects.push({start,end,stroke,fill,layer,uuid})}let fp_arcs=[],fp_arcs_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_arc");for(let fp_arc_row of fp_arcs_rows){let start=getAttr(fp_arc_row,"start"),mid=getAttr(fp_arc_row,"mid"),end=getAttr(fp_arc_row,"end"),stroke=getAttr(fp_arc_row,"stroke"),layer=getAttr(fp_arc_row,"layer"),uuid=getAttr(fp_arc_row,"uuid");!start||!end||!mid||!stroke||!layer||fp_arcs.push({start,mid,end,stroke,layer,uuid})}let fp_circles=[],fp_circles_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_circle");for(let fp_circle_row of fp_circles_rows){let center2=getAttr(fp_circle_row,"center"),end=getAttr(fp_circle_row,"end"),stroke=getAttr(fp_circle_row,"stroke"),fill=getAttr(fp_circle_row,"fill"),layer=getAttr(fp_circle_row,"layer"),uuid=getAttr(fp_circle_row,"uuid");!center2||!end||!stroke||!layer||fp_circles.push({center:center2,end,stroke,fill,layer,uuid})}let fp_polys=[],fp_polys_rows=kicadSExpr.slice(2).filter(row=>row[0]==="fp_poly");for(let fp_poly_row of fp_polys_rows){let pts=getAttr(fp_poly_row,"pts"),stroke=getAttr(fp_poly_row,"stroke"),width=getAttr(fp_poly_row,"width"),layer=getAttr(fp_poly_row,"layer"),uuid=getAttr(fp_poly_row,"uuid"),fill=getAttr(fp_poly_row,"fill"),normalizedStroke=stroke;!normalizedStroke&&typeof width=="number"?normalizedStroke={width,type:"solid"}:normalizedStroke&&typeof normalizedStroke=="object"&&typeof width=="number"&&normalizedStroke.width===void 0&&(normalizedStroke={...normalizedStroke,width}),fp_polys.push({pts,stroke:normalizedStroke,layer,uuid,fill})}let holes=[];for(let row of kicadSExpr.slice(2)){if(row[0]!=="pad"||row[2]?.valueOf?.()!=="thru_hole")continue;let name=row[1]?.valueOf?.(),pad_type=row[2]?.valueOf?.(),pad_shape=row[3]?.valueOf?.(),at3=getAttr(row,"at"),drill=getAttr(row,"drill"),size3=getAttr(row,"size");Array.isArray(size3)&&(size3[0]==="size"&&(size3=size3.slice(1)),size3={width:Number(size3[0]),height:Number(size3[1])});let uuid=getAttr(row,"uuid"),roundrect_rratio=getAttr(row,"roundrect_rratio"),layers=getAttr(row,"layers");Array.isArray(layers)?layers=layers.map(layer=>layer.valueOf()):typeof layers=="string"?layers=[layers]:layers||(layers=[]);let holeRaw={name,pad_type,pad_shape,at:at3,drill,size:size3,layers,roundrect_rratio,uuid};debug11(`attempting to parse holes: ${JSON.stringify(holeRaw,null,2)}`),holes.push(hole_def.parse(holeRaw))}return kicad_mod_json_def.parse({footprint_name:footprintName,...topLevelAttributes,properties,fp_lines,fp_rects,fp_texts,fp_arcs,fp_circles,pads,holes,fp_polys})},TWO_PI=Math.PI*2,normalizeAngle2=angle=>{let result=angle%TWO_PI;return result<0&&(result+=TWO_PI),result},directedAngleCCW=(start,target)=>{let startNorm=normalizeAngle2(start),delta=normalizeAngle2(target)-startNorm;return delta<0&&(delta+=TWO_PI),delta};function calculateCenter(start,mid,end){let mid1={x:(start.x+mid.x)/2,y:(start.y+mid.y)/2},mid2={x:(mid.x+end.x)/2,y:(mid.y+end.y)/2},slope1=-(start.x-mid.x)/(start.y-mid.y),slope2=-(mid.x-end.x)/(mid.y-end.y),centerX=(mid1.y-mid2.y+slope2*mid2.x-slope1*mid1.x)/(slope2-slope1),centerY=mid1.y+slope1*(centerX-mid1.x);return{x:centerX,y:centerY}}function calculateRadius(center2,point42){return Math.sqrt((center2.x-point42.x)**2+(center2.y-point42.y)**2)}function calculateAngle(center2,point42){return Math.atan2(point42.y-center2.y,point42.x-center2.x)}var getArcLength2=(start,mid,end)=>{let center2=calculateCenter(start,mid,end),radius=calculateRadius(center2,start),angleStart=calculateAngle(center2,start),angleMid=calculateAngle(center2,mid),angleEnd=calculateAngle(center2,end),ccwToMid=directedAngleCCW(angleStart,angleMid),ccwToEnd=directedAngleCCW(angleStart,angleEnd),angleDelta=ccwToEnd;return ccwToMid>ccwToEnd&&(angleDelta=ccwToEnd-TWO_PI),Math.abs(radius*angleDelta)};function generateArcPath(start,mid,end,numPoints){let center2=calculateCenter(start,mid,end),radius=calculateRadius(center2,start),angleStart=calculateAngle(center2,start),angleMid=calculateAngle(center2,mid),angleEnd=calculateAngle(center2,end),ccwToMid=directedAngleCCW(angleStart,angleMid),ccwToEnd=directedAngleCCW(angleStart,angleEnd),angleDelta=ccwToEnd;ccwToMid>ccwToEnd&&(angleDelta=ccwToEnd-TWO_PI);let path=[];for(let i3=0;i3<=numPoints;i3++){let angle=angleStart+i3/numPoints*angleDelta,x4=center2.x+radius*Math.cos(angle),y4=center2.y+radius*Math.sin(angle);path.push({x:x4,y:y4})}return path}var makePoint=p4=>Array.isArray(p4)?{x:p4[0],y:p4[1]}:p4,pointsEqual4=(p12,p22,tolerance=1e-4)=>Math.abs(p12.x-p22.x)<tolerance&&Math.abs(p12.y-p22.y)<tolerance,findClosedPolygons=segments=>{let polygons=[],used=new Set;for(let i3=0;i3<segments.length;i3++){if(used.has(i3))continue;let polygon2=[segments[i3]];used.add(i3);let currentEnd=segments[i3].end,foundNext=!0;for(;foundNext;){if(foundNext=!1,polygon2.length>1&&pointsEqual4(currentEnd,polygon2[0].start)){polygons.push(polygon2);break}for(let j4=0;j4<segments.length;j4++)if(!used.has(j4)){if(pointsEqual4(currentEnd,segments[j4].start)){polygon2.push(segments[j4]),used.add(j4),currentEnd=segments[j4].end,foundNext=!0;break}else if(pointsEqual4(currentEnd,segments[j4].end)){segments[j4].type==="arc"?polygon2.push({...segments[j4],reversed:!0}):polygon2.push({...segments[j4],start:segments[j4].end,end:segments[j4].start}),used.add(j4),currentEnd=segments[j4].start,foundNext=!0;break}}if(!foundNext){for(let k4=polygon2.length-1;k4>=0;k4--){let idx=segments.indexOf(polygon2[k4]);idx!==-1&&used.delete(idx)}break}}}return polygons},polygonToPoints=polygon2=>{let points=[];for(let segment2 of polygon2)if(segment2.type==="line")points.push(segment2.start);else if(segment2.type==="arc"&&segment2.mid){let arcLength2=getArcLength2(segment2.start,segment2.mid,segment2.end),numPoints=Math.max(3,Math.ceil(arcLength2)),arcPoints=generateArcPath(segment2.start,segment2.mid,segment2.end,numPoints);segment2.reversed&&(arcPoints=arcPoints.reverse()),points.push(...arcPoints.slice(0,-1))}return points};function getSilkscreenFontSizeFromFpTexts(fp_texts){if(!Array.isArray(fp_texts))return null;let refText=fp_texts.find(t52=>t52.layer?.toLowerCase()==="f.silks"&&(t52.text?.includes("${REFERENCE}")||t52.fp_text_type?.toLowerCase()==="reference"||t52.text?.match(/^R\d+|C\d+|U\d+/))),fallbackText=refText||fp_texts.find(t52=>t52.layer?.toLowerCase()==="f.fab"&&(t52.text?.includes("${REFERENCE}")||t52.fp_text_type?.toLowerCase()==="reference")),target=refText||fallbackText;if(!target?.effects?.font?.size)return null;let[width,height]=target.effects.font.size;return height??width??1}var degToRad=deg=>deg*Math.PI/180,rotatePoint4=(x4,y4,deg)=>{let r5=degToRad(deg),cos6=Math.cos(r5),sin6=Math.sin(r5);return{x:x4*cos6-y4*sin6,y:x4*sin6+y4*cos6}},getAxisAlignedRectFromPoints=points=>{let uniquePoints=[...new Map(points.map(p4=>[`${p4.x},${p4.y}`,p4])).values()];if(uniquePoints.length!==4)return null;let xs3=uniquePoints.map(p4=>p4.x),ys3=uniquePoints.map(p4=>p4.y),uniqueXs=[...new Set(xs3)],uniqueYs=[...new Set(ys3)];if(uniqueXs.length!==2||uniqueYs.length!==2)return null;let[minX,maxX]=uniqueXs.sort((a3,b3)=>a3-b3),[minY,maxY]=uniqueYs.sort((a3,b3)=>a3-b3);return minX===void 0||maxX===void 0||minY===void 0||maxY===void 0?null:{x:(minX+maxX)/2,y:(minY+maxY)/2,width:maxX-minX,height:maxY-minY}},fpPolyHasFill=fill=>{if(!fill)return!1;let normalized=fill.toLowerCase();return normalized!=="no"&&normalized!=="none"&&normalized!=="outline"},getRotationDeg=at3=>at3&&Array.isArray(at3)&&at3.length>=3&&typeof at3[2]=="number"?at3[2]:0,isNinetyLike=deg=>{let n4=(deg%360+360)%360;return n4===90||n4===270},normalizePortName=name=>{if(name!=null)return`${name}`},getPinNumber=name=>{let normalized=normalizePortName(name),parsed=normalized!==void 0?Number(normalized):NaN;return Number.isFinite(parsed)?parsed:void 0},debug23=(0,import_debug21.default)("kicad-mod-converter"),convertKicadLayerToTscircuitLayer=kicadLayer=>{switch(kicadLayer.toLowerCase()){case"f.cu":case"f.fab":case"f.silks":case"f.crtyd":case"edge.cuts":return"top";case"b.cu":case"b.fab":case"b.silks":case"b.crtyd":return"bottom"}},convertKicadJsonToTsCircuitSoup=async kicadJson=>{let{fp_lines,fp_rects,fp_texts,fp_arcs,fp_circles,pads,properties,holes,fp_polys}=kicadJson,circuitJson=[];circuitJson.push({type:"source_component",source_component_id:"source_component_0",supplier_part_numbers:{}}),circuitJson.push({type:"schematic_component",schematic_component_id:"schematic_component_0",source_component_id:"source_component_0",center:{x:0,y:0},rotation:0,size:{width:0,height:0}});let portNames=new Set,portNameToPinNumber=new Map;for(let pad2 of pads){let portName=normalizePortName(pad2.name);if(portName){portNames.add(portName);let pinNumber=getPinNumber(pad2.name);pinNumber!==void 0&&portNameToPinNumber.set(portName,pinNumber)}}if(holes)for(let hole of holes){let portName=normalizePortName(hole.name);if(portName){portNames.add(portName);let pinNumber=getPinNumber(hole.name);pinNumber!==void 0&&portNameToPinNumber.set(portName,pinNumber)}}let sourcePortId=0,portNameToSourcePortId=new Map;for(let portName of portNames){let source_port_id=`source_port_${sourcePortId++}`;portNameToSourcePortId.set(portName,source_port_id);let pinNumber=portNameToPinNumber.get(portName);circuitJson.push({type:"source_port",source_port_id,source_component_id:"source_component_0",name:portName,port_hints:[portName],pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0}),circuitJson.push({type:"schematic_port",schematic_port_id:`schematic_port_${sourcePortId++}`,source_port_id,schematic_component_id:"schematic_component_0",center:{x:0,y:0}})}let minX=Number.POSITIVE_INFINITY,maxX=Number.NEGATIVE_INFINITY,minY=Number.POSITIVE_INFINITY,maxY=Number.NEGATIVE_INFINITY;for(let pad2 of pads){let x4=pad2.at[0],y4=-pad2.at[1],w4=pad2.size[0],h6=pad2.size[1];minX=Math.min(minX,x4-w4/2),maxX=Math.max(maxX,x4+w4/2),minY=Math.min(minY,y4-h6/2),maxY=Math.max(maxY,y4+h6/2)}let pcb_component_id="pcb_component_0";circuitJson.push({type:"pcb_component",source_component_id:"source_component_0",pcb_component_id,layer:"top",center:{x:0,y:0},rotation:0,width:Number.isFinite(minX)?maxX-minX:0,height:Number.isFinite(minY)?maxY-minY:0});let pcbPortId=0,portNameToPcbPortId=new Map;for(let portName of portNames){let pcb_port_id=`pcb_port_${pcbPortId++}`,source_port_id=portNameToSourcePortId.get(portName);portNameToPcbPortId.set(portName,pcb_port_id);let x4=0,y4=0,layers=["top","bottom"],pad2=pads.find(p4=>normalizePortName(p4.name)===portName);if(pad2)x4=pad2.at[0],y4=-pad2.at[1],layers=pad2.layers?pad2.layers.map(l4=>convertKicadLayerToTscircuitLayer(l4)).filter(Boolean):["top","bottom"];else if(holes){let hole=holes.find(h6=>normalizePortName(h6.name)===portName);hole&&(x4=hole.at[0],y4=-hole.at[1],layers=hole.layers?hole.layers.map(l4=>convertKicadLayerToTscircuitLayer(l4)).filter(Boolean):["top","bottom"])}circuitJson.push({type:"pcb_port",pcb_port_id,source_port_id,pcb_component_id,x:x4,y:y4,layers})}let smtpadId=0,platedHoleId=0,holeId=0;for(let pad2 of pads){let portName=normalizePortName(pad2.name),pinNumber=portName?portNameToPinNumber.get(portName):void 0;if(pad2.pad_type==="smd"){let rotation5=getRotationDeg(pad2.at),width=isNinetyLike(rotation5)?pad2.size[1]:pad2.size[0],height=isNinetyLike(rotation5)?pad2.size[0]:pad2.size[1],pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,pinLabel=pinNumber!==void 0?`pin${pinNumber}`:void 0;circuitJson.push({type:"pcb_smtpad",pcb_smtpad_id:`pcb_smtpad_${smtpadId++}`,shape:"rect",x:pad2.at[0],y:-pad2.at[1],width,height,layer:convertKicadLayerToTscircuitLayer(pad2.layers?.[0]??"F.Cu"),pcb_component_id,port_hints:pinLabel?[pinLabel]:portName?[portName]:[],pcb_port_id,pin_number:pinNumber,pin_label:pinLabel})}else if(pad2.pad_type==="thru_hole"){if(pad2.pad_shape==="rect"){let rotation5=getRotationDeg(pad2.at),width=isNinetyLike(rotation5)?pad2.size[1]:pad2.size[0],height=isNinetyLike(rotation5)?pad2.size[0]:pad2.size[1],offX=pad2.drill?.offset?.[0]??0,offY=pad2.drill?.offset?.[1]??0,rotOff=rotatePoint4(offX,offY,rotation5),pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,pinLabel=pinNumber!==void 0?`pin${pinNumber}`:void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circular_hole_with_rect_pad",hole_shape:"circle",pad_shape:"rect",x:pad2.at[0],y:-pad2.at[1],hole_offset_x:-rotOff.x,hole_offset_y:-rotOff.y,hole_diameter:pad2.drill?.width,rect_pad_width:width,rect_pad_height:height,layers:["top","bottom"],pcb_component_id,port_hints:pinLabel?[pinLabel]:portName?[portName]:[],pcb_port_id,pin_number:pinNumber,pin_label:pinLabel})}else if(pad2.pad_shape==="circle"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,pinLabel=pinNumber!==void 0?`pin${pinNumber}`:void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circle",x:pad2.at[0],y:-pad2.at[1],outer_diameter:pad2.size[0],hole_diameter:pad2.drill?.width,layers:["top","bottom"],pcb_component_id,port_hints:pinLabel?[pinLabel]:portName?[portName]:[],pcb_port_id,pin_number:pinNumber,pin_label:pinLabel})}else if(pad2.pad_shape==="oval"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,pinLabel=pinNumber!==void 0?`pin${pinNumber}`:void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"pill",x:pad2.at[0],y:-pad2.at[1],outer_width:pad2.size[0],outer_height:pad2.size[1],hole_width:pad2.drill?.width,hole_height:pad2.drill?.height,layers:["top","bottom"],pcb_component_id,port_hints:pinLabel?[pinLabel]:portName?[portName]:[],pcb_port_id,pin_number:pinNumber,pin_label:pinLabel})}}else pad2.pad_type==="np_thru_hole"&&pad2.pad_shape==="circle"&&circuitJson.push({type:"pcb_hole",pcb_hole_id:`pcb_hole_${holeId++}`,x:pad2.at[0],y:-pad2.at[1],hole_shape:"circle",hole_diameter:pad2.drill?.width??pad2.size[0],pcb_component_id})}if(holes)for(let hole of holes){let portName=normalizePortName(hole.name),pinNumber=portName?portNameToPinNumber.get(portName):void 0,hasCuLayer=hole.layers?.some(l4=>l4.endsWith(".Cu")||l4==="*.Cu"),rotation5=getRotationDeg(hole.at),offX=hole.drill?.offset?.[0]??0,offY=hole.drill?.offset?.[1]??0,rotOff=rotatePoint4(offX,offY,rotation5),x4=hole.at[0]+rotOff.x,y4=-(hole.at[1]+rotOff.y),holeDiameter=hole.drill?.width??0,outerDiameter=hole.size?.width??holeDiameter,rr3=hole.roundrect_rratio??0,rectBorderRadius=rr3>0?Math.min(isNinetyLike(rotation5)?hole.size?.height??outerDiameter:hole.size?.width??outerDiameter,isNinetyLike(rotation5)?hole.size?.width??outerDiameter:hole.size?.height??outerDiameter)/2*rr3:0;if(hasCuLayer)if(hole.pad_shape==="rect"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circular_hole_with_rect_pad",hole_shape:"circle",pad_shape:"rect",x:hole.at[0],y:-hole.at[1],hole_offset_x:-rotOff.x,hole_offset_y:-rotOff.y,hole_diameter:holeDiameter,rect_pad_width:isNinetyLike(rotation5)?hole.size?.height??outerDiameter:hole.size?.width??outerDiameter,rect_pad_height:isNinetyLike(rotation5)?hole.size?.width??outerDiameter:hole.size?.height??outerDiameter,rect_border_radius:rectBorderRadius,port_hints:pinNumber!==void 0?[`pin${pinNumber}`]:portName?[portName]:[],layers:["top","bottom"],pcb_component_id,pcb_port_id,pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0})}else if(hole.pad_shape==="oval"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"pill",x:x4,y:y4,outer_width:isNinetyLike(rotation5)?hole.size?.height??outerDiameter:hole.size?.width??outerDiameter,outer_height:isNinetyLike(rotation5)?hole.size?.width??outerDiameter:hole.size?.height??outerDiameter,hole_width:isNinetyLike(rotation5)?hole.drill?.height??holeDiameter:hole.drill?.width??holeDiameter,hole_height:isNinetyLike(rotation5)?hole.drill?.width??holeDiameter:hole.drill?.height??holeDiameter,port_hints:pinNumber!==void 0?[`pin${pinNumber}`]:portName?[portName]:[],layers:["top","bottom"],pcb_component_id,pcb_port_id,pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0})}else if(hole.pad_shape==="roundrect"){let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0,offX2=hole.drill?.offset?.[0]??0,offY2=hole.drill?.offset?.[1]??0,rotOff2=rotatePoint4(offX2,offY2,rotation5),width=isNinetyLike(rotation5)?hole.size?.height??outerDiameter:hole.size?.width??outerDiameter,height=isNinetyLike(rotation5)?hole.size?.width??outerDiameter:hole.size?.height??outerDiameter;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circular_hole_with_rect_pad",hole_shape:"circle",pad_shape:"rect",x:x4,y:y4,hole_offset_x:-rotOff2.x,hole_offset_y:rotOff2.y,hole_diameter:holeDiameter,rect_pad_width:width,rect_pad_height:height,rect_border_radius:rectBorderRadius,port_hints:pinNumber!==void 0?[`pin${pinNumber}`]:portName?[portName]:[],layers:["top","bottom"],pcb_component_id,pcb_port_id,pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0})}else{let pcb_port_id=portName?portNameToPcbPortId.get(portName):void 0;circuitJson.push({type:"pcb_plated_hole",pcb_plated_hole_id:`pcb_plated_hole_${platedHoleId++}`,shape:"circle",x:x4,y:y4,outer_diameter:outerDiameter,hole_diameter:holeDiameter,port_hints:pinNumber!==void 0?[`pin${pinNumber}`]:portName?[portName]:[],layers:["top","bottom"],pcb_component_id,pcb_port_id,pin_number:pinNumber,pin_label:pinNumber!==void 0?`pin${pinNumber}`:void 0})}else circuitJson.push({type:"pcb_hole",pcb_hole_id:`pcb_hole_${holeId++}`,x:x4,y:y4,hole_shape:"circle",hole_diameter:holeDiameter,pcb_component_id})}let edgeCutSegments=[],frontCourtyardSegments=[],backCourtyardSegments=[];for(let fp_line2 of fp_lines){let lowerLayer=fp_line2.layer.toLowerCase();lowerLayer==="edge.cuts"?edgeCutSegments.push({type:"line",start:{x:fp_line2.start[0],y:fp_line2.start[1]},end:{x:fp_line2.end[0],y:fp_line2.end[1]},strokeWidth:fp_line2.stroke.width}):lowerLayer==="f.crtyd"?frontCourtyardSegments.push({type:"line",start:{x:fp_line2.start[0],y:fp_line2.start[1]},end:{x:fp_line2.end[0],y:fp_line2.end[1]},strokeWidth:fp_line2.stroke.width}):lowerLayer==="b.crtyd"&&backCourtyardSegments.push({type:"line",start:{x:fp_line2.start[0],y:fp_line2.start[1]},end:{x:fp_line2.end[0],y:fp_line2.end[1]},strokeWidth:fp_line2.stroke.width})}for(let fp_arc of fp_arcs){let lowerLayer=fp_arc.layer.toLowerCase();lowerLayer==="edge.cuts"?edgeCutSegments.push({type:"arc",start:{x:fp_arc.start[0],y:fp_arc.start[1]},mid:{x:fp_arc.mid[0],y:fp_arc.mid[1]},end:{x:fp_arc.end[0],y:fp_arc.end[1]},strokeWidth:fp_arc.stroke.width}):lowerLayer==="f.crtyd"?frontCourtyardSegments.push({type:"arc",start:{x:fp_arc.start[0],y:fp_arc.start[1]},mid:{x:fp_arc.mid[0],y:fp_arc.mid[1]},end:{x:fp_arc.end[0],y:fp_arc.end[1]},strokeWidth:fp_arc.stroke.width}):lowerLayer==="b.crtyd"&&backCourtyardSegments.push({type:"arc",start:{x:fp_arc.start[0],y:fp_arc.start[1]},mid:{x:fp_arc.mid[0],y:fp_arc.mid[1]},end:{x:fp_arc.end[0],y:fp_arc.end[1]},strokeWidth:fp_arc.stroke.width})}let closedPolygons=findClosedPolygons(edgeCutSegments),cutoutId=0;for(let polygon2 of closedPolygons){let points=polygonToPoints(polygon2);points.length>=3&&circuitJson.push({type:"pcb_cutout",pcb_cutout_id:`pcb_cutout_${cutoutId++}`,shape:"polygon",points:points.map(p4=>({x:p4.x,y:-p4.y})),pcb_component_id})}let courtyardOutlineId=0;for(let[segments,layer]of[[frontCourtyardSegments,"top"],[backCourtyardSegments,"bottom"]]){let closedCourtyardPolygons=findClosedPolygons(segments);for(let polygon2 of closedCourtyardPolygons){let points=polygonToPoints(polygon2);points.length>=3&&circuitJson.push({type:"pcb_courtyard_outline",pcb_courtyard_outline_id:`pcb_courtyard_outline_${courtyardOutlineId++}`,layer,pcb_component_id,outline:points.map(p4=>({x:p4.x,y:-p4.y}))})}}if(fp_rects)for(let fp_rect of fp_rects){let lowerLayer=fp_rect.layer.toLowerCase();if(lowerLayer==="f.crtyd"||lowerLayer==="b.crtyd"){let x12=fp_rect.start[0],y12=fp_rect.start[1],x22=fp_rect.end[0],y22=fp_rect.end[1];circuitJson.push({type:"pcb_courtyard_rect",pcb_courtyard_rect_id:`pcb_courtyard_rect_${courtyardOutlineId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_rect.layer),center:{x:(x12+x22)/2,y:-((y12+y22)/2)},width:Math.abs(x22-x12),height:Math.abs(y22-y12)})}else debug23("Unhandled layer for fp_rect",fp_rect.layer)}let traceId=0,silkPathId=0,fabPathId=0,noteLineId=0;for(let fp_line2 of fp_lines){let route=[{x:fp_line2.start[0],y:-fp_line2.start[1]},{x:fp_line2.end[0],y:-fp_line2.end[1]}],lowerLayer=fp_line2.layer.toLowerCase();lowerLayer==="f.cu"?circuitJson.push({type:"pcb_trace",pcb_trace_id:`pcb_trace_${traceId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_line2.layer),route,thickness:fp_line2.stroke.width}):lowerLayer==="f.silks"?circuitJson.push({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_path_${silkPathId++}`,pcb_component_id,layer:"top",route,stroke_width:fp_line2.stroke.width}):lowerLayer==="edge.cuts"?debug23("Skipping Edge.Cuts fp_line (converted to pcb_cutout)",fp_line2.layer):lowerLayer==="f.crtyd"||lowerLayer==="b.crtyd"?debug23("Skipping CrtYd fp_line (converted to pcb_courtyard_outline)",fp_line2.layer):lowerLayer==="f.fab"?circuitJson.push({type:"pcb_fabrication_note_path",fabrication_note_path_id:`fabrication_note_path_${fabPathId++}`,pcb_component_id,layer:"top",route,stroke_width:fp_line2.stroke.width,port_hints:[]}):lowerLayer.startsWith("user.")?circuitJson.push({type:"pcb_note_line",pcb_note_line_id:`pcb_note_line_${noteLineId++}`,pcb_component_id,x1:fp_line2.start[0],y1:-fp_line2.start[1],x2:fp_line2.end[0],y2:-fp_line2.end[1],stroke_width:fp_line2.stroke.width}):debug23("Unhandled layer for fp_line",fp_line2.layer)}if(fp_polys)for(let fp_poly of fp_polys){let route=[],pushRoutePoint=point42=>{!Number.isFinite(point42.x)||!Number.isFinite(point42.y)||route.push(point42)};for(let segment2 of fp_poly.pts){if(Array.isArray(segment2)){pushRoutePoint({x:segment2[0],y:-segment2[1]});continue}if(segment2&&typeof segment2=="object"&&"kind"in segment2){if(segment2.kind==="arc"){let start=makePoint(segment2.start),mid=makePoint(segment2.mid),end=makePoint(segment2.end),arcLength2=getArcLength2(start,mid,end),adjustedNumPoints=Math.max(2,Math.ceil(arcLength2/.1)),arcPoints=generateArcPath(start,mid,end,adjustedNumPoints).map(p4=>({x:p4.x,y:-p4.y}));for(let point42 of arcPoints)pushRoutePoint(point42)}continue}}let routePoints=route,polygonPoints=routePoints.length>2&&routePoints[0].x===routePoints[routePoints.length-1].x&&routePoints[0].y===routePoints[routePoints.length-1].y?routePoints.slice(0,-1):routePoints;if(routePoints.length===0)continue;let strokeWidth=fp_poly.stroke?.width??0;if(fp_poly.layer.endsWith(".Cu")){let rect=getAxisAlignedRectFromPoints(polygonPoints);rect?circuitJson.push({type:"pcb_smtpad",pcb_smtpad_id:`pcb_smtpad_${smtpadId++}`,shape:"rect",x:rect.x,y:rect.y,width:rect.width,height:rect.height,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),pcb_component_id}):fpPolyHasFill(fp_poly.fill)?polygonPoints.length>=3?circuitJson.push({type:"pcb_smtpad",pcb_smtpad_id:`pcb_smtpad_${smtpadId++}`,shape:"polygon",points:polygonPoints,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),pcb_component_id}):polygonPoints.length>=2&&circuitJson.push({type:"pcb_trace",pcb_trace_id:`pcb_trace_${traceId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),route:polygonPoints,thickness:strokeWidth}):polygonPoints.length>=2&&circuitJson.push({type:"pcb_trace",pcb_trace_id:`pcb_trace_${traceId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),route:polygonPoints,thickness:strokeWidth})}else fp_poly.layer.endsWith(".SilkS")?circuitJson.push({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_path_${silkPathId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),route:routePoints,stroke_width:strokeWidth}):fp_poly.layer.endsWith(".Fab")?circuitJson.push({type:"pcb_fabrication_note_path",fabrication_note_path_id:`fabrication_note_path_${fabPathId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),route:polygonPoints,stroke_width:strokeWidth,port_hints:[]}):fp_poly.layer.toLowerCase().endsWith(".crtyd")?polygonPoints.length>=3&&circuitJson.push({type:"pcb_courtyard_polygon",pcb_courtyard_polygon_id:`pcb_courtyard_polygon_${courtyardOutlineId++}`,layer:convertKicadLayerToTscircuitLayer(fp_poly.layer),pcb_component_id,points:polygonPoints}):debug23("Unhandled layer for fp_poly",fp_poly.layer)}let notePathId=0;for(let fp_arc of fp_arcs){let lowerLayer=fp_arc.layer.toLowerCase();if(lowerLayer==="edge.cuts"){debug23("Skipping Edge.Cuts fp_arc (converted to pcb_cutout)",fp_arc.layer);continue}if(lowerLayer==="f.crtyd"||lowerLayer==="b.crtyd"){debug23("Skipping CrtYd fp_arc (converted to pcb_courtyard_outline)",fp_arc.layer);continue}let start=makePoint(fp_arc.start),mid=makePoint(fp_arc.mid),end=makePoint(fp_arc.end),arcLength2=getArcLength2(start,mid,end),arcPoints=generateArcPath(start,mid,end,Math.ceil(arcLength2));if(lowerLayer.startsWith("user.")){circuitJson.push({type:"pcb_note_path",pcb_note_path_id:`pcb_note_path_${notePathId++}`,pcb_component_id,route:arcPoints.map(p4=>({x:p4.x,y:-p4.y})),stroke_width:fp_arc.stroke.width});continue}let tscircuitLayer=convertKicadLayerToTscircuitLayer(fp_arc.layer);if(!tscircuitLayer){debug23("Unable to convert layer for fp_arc",fp_arc.layer);continue}circuitJson.push({type:"pcb_silkscreen_path",pcb_silkscreen_path_id:`pcb_silkscreen_path_${silkPathId++}`,layer:tscircuitLayer,pcb_component_id,route:arcPoints.map(p4=>({x:p4.x,y:-p4.y})),stroke_width:fp_arc.stroke.width})}if(fp_circles)for(let fp_circle of fp_circles){let lowerLayer=fp_circle.layer.toLowerCase(),center2=makePoint(fp_circle.center),endPoint=makePoint(fp_circle.end),radius=Math.sqrt((endPoint.x-center2.x)**2+(endPoint.y-center2.y)**2),numPoints=Math.max(16,Math.ceil(2*Math.PI*radius)),circlePoints=[];for(let i3=0;i3<=numPoints;i3++){let angle=i3/numPoints*2*Math.PI;circlePoints.push({x:center2.x+radius*Math.cos(angle),y:center2.y+radius*Math.sin(angle)})}lowerLayer.startsWith("user.")?circuitJson.push({type:"pcb_note_path",pcb_note_path_id:`pcb_note_path_${notePathId++}`,pcb_component_id,route:circlePoints.map(p4=>({x:p4.x,y:-p4.y})),stroke_width:fp_circle.stroke.width}):(lowerLayer==="f.crtyd"||lowerLayer==="b.crtyd")&&circuitJson.push({type:"pcb_courtyard_circle",pcb_courtyard_circle_id:`pcb_courtyard_circle_${courtyardOutlineId++}`,pcb_component_id,layer:convertKicadLayerToTscircuitLayer(fp_circle.layer),center:{x:center2.x,y:-center2.y},radius})}for(let fp_text of fp_texts){let layerRef=convertKicadLayerToTscircuitLayer(fp_text.layer);fp_text.layer.endsWith(".SilkS")?circuitJson.push({type:"pcb_silkscreen_text",layer:layerRef,font:"tscircuit2024",font_size:fp_text.effects?.font?.size[0]??1,pcb_component_id,anchor_position:{x:fp_text.at[0],y:-fp_text.at[1]},anchor_alignment:"center",text:fp_text.text}):fp_text.layer.endsWith(".Fab")?circuitJson.push({type:"pcb_fabrication_note_text",layer:layerRef,font:"tscircuit2024",font_size:fp_text.effects?.font?.size[0]??1,pcb_component_id,anchor_position:{x:fp_text.at[0],y:-fp_text.at[1]},anchor_alignment:"center",text:fp_text.text}):debug23("Unhandled layer for fp_text",fp_text.layer)}let refProp=properties.find(prop=>prop.key==="Reference"),valProp=properties.find(prop=>prop.key==="Value"),propFabTexts=[refProp,valProp].filter(p4=>p4&&!!p4.val);for(let propFab of propFabTexts){let at3=propFab.attributes.at;if(!at3)continue;let isFabLayer=propFab.attributes.layer?.toLowerCase()?.endsWith(".fab"),font_size=getSilkscreenFontSizeFromFpTexts(fp_texts);circuitJson.push({type:isFabLayer?"pcb_fabrication_note_text":"pcb_silkscreen_text",layer:"top",font:"tscircuit2024",font_size,pcb_component_id,anchor_position:{x:at3[0],y:-at3[1]},anchor_alignment:"center",text:propFab.val})}return circuitJson},parseKicadModToCircuitJson=async kicadMod=>{let kicadJson=parseKicadModToKicadJson(kicadMod);return await convertKicadJsonToTsCircuitSoup(kicadJson)};var transformJsDelivrImports=code=>code.replace(/from\s*["']\/npm\//g,'from "https://cdn.jsdelivr.net/npm/').replace(/import\s*\(\s*["']\/npm\//g,'import("https://cdn.jsdelivr.net/npm/'),dynamicallyLoadDependencyWithCdnBackup=async packageName=>{try{return(await import(packageName)).default}catch{console.log(`Failed to load ${packageName} locally, trying CDN fallback...`);try{let res2=await fetch(`https://cdn.jsdelivr.net/npm/${packageName}/+esm`);if(!res2.ok)throw new Error(`Failed to fetch ${packageName} from CDN: ${res2.statusText}`);let code=await res2.text();code=transformJsDelivrImports(code);let blob=new Blob([code],{type:"application/javascript"}),url2=URL.createObjectURL(blob);try{let{default:loadedModule}=await import(url2);return loadedModule}finally{URL.revokeObjectURL(url2)}}catch(cdnError){throw console.error(`CDN fallback for ${packageName} also failed:`,cdnError),cdnError}}};var KICAD_FOOTPRINT_CACHE_URL="https://kicad-mod-cache.tscircuit.com",ngspiceEngineCache=null,getPlatformConfig=(overrides={},options={})=>{let partsEngine2=overrides.partsEngine??jlcPartsEngine;return!overrides.partsEngine&&options.easyEdaProxyConfig&&(partsEngine2=new JlcPcbPartsEngine({platformFetch:overrides.platformFetch,easyEdaProxyConfig:options.easyEdaProxyConfig})),{localCacheEngine:overrides.localCacheEngine,partsEngine:partsEngine2,autorouterMap:{krt:{createAutorouter:createKiCadRoutingToolsAutorouter({gridStep:.1,clearance:.2,maxIterations:3e5})},...overrides.autorouterMap},spiceEngineMap:{ngspice:{simulate:async spice=>{if(!ngspiceEngineCache){let createNgspiceSpiceEngine=await dynamicallyLoadDependencyWithCdnBackup("@tscircuit/ngspice-spice-engine").catch(error2=>{throw new Error("Could not load ngspice engine from local node_modules or CDN fallback.",{cause:error2})});createNgspiceSpiceEngine&&(ngspiceEngineCache=await createNgspiceSpiceEngine())}if(!ngspiceEngineCache)throw new Error("Could not load ngspice engine from local node_modules or CDN fallback.");return ngspiceEngineCache.simulate(spice)}}},footprintLibraryMap:{kicad:async footprintName=>{let baseUrl=`${KICAD_FOOTPRINT_CACHE_URL}/${footprintName}`,circuitJsonUrl=`${baseUrl}.circuit.json`,res2=await fetch(circuitJsonUrl);if(!res2.ok){let bodyPreview=(await res2.text()).slice(0,200);throw new Error(`Failed to load KiCad footprint "${footprintName}" from ${circuitJsonUrl} (HTTP ${res2.status}). ${bodyPreview}`)}let raw;try{raw=await res2.json()}catch{throw new Error(`Failed to parse KiCad footprint JSON for "${footprintName}" from ${circuitJsonUrl}`)}let filtered=Array.isArray(raw)?raw.filter(el3=>el3?.type==="pcb_silkscreen_text"?el3?.text==="REF**":!0):[raw],wrlUrl=`${baseUrl}.wrl`,stepUrl=`${baseUrl}.step`;return{footprintCircuitJson:filtered,cadModel:{wrlUrl,stepUrl,modelUnitToMmScale:2.54}}}},footprintFileParserMap:{kicad_mod:{loadFromUrl:async url2=>{let kicadContent=await fetch(url2).then(res2=>res2.text()),kicadJson=await parseKicadModToCircuitJson(kicadContent);return{footprintCircuitJson:Array.isArray(kicadJson)?kicadJson:[kicadJson]}}}}}};var tslib_es6_exports={};__export(tslib_es6_exports,{__addDisposableResource:()=>__addDisposableResource,__assign:()=>__assign,__asyncDelegator:()=>__asyncDelegator,__asyncGenerator:()=>__asyncGenerator,__asyncValues:()=>__asyncValues,__await:()=>__await,__awaiter:()=>__awaiter,__classPrivateFieldGet:()=>__classPrivateFieldGet,__classPrivateFieldIn:()=>__classPrivateFieldIn,__classPrivateFieldSet:()=>__classPrivateFieldSet,__createBinding:()=>__createBinding,__decorate:()=>__decorate,__disposeResources:()=>__disposeResources,__esDecorate:()=>__esDecorate,__exportStar:()=>__exportStar,__extends:()=>__extends,__generator:()=>__generator,__importDefault:()=>__importDefault,__importStar:()=>__importStar,__makeTemplateObject:()=>__makeTemplateObject,__metadata:()=>__metadata,__param:()=>__param,__propKey:()=>__propKey,__read:()=>__read,__rest:()=>__rest,__rewriteRelativeImportExtension:()=>__rewriteRelativeImportExtension,__runInitializers:()=>__runInitializers,__setFunctionName:()=>__setFunctionName,__spread:()=>__spread,__spreadArray:()=>__spreadArray,__spreadArrays:()=>__spreadArrays,__values:()=>__values,default:()=>tslib_es6_default});var extendStatics=function(d4,b3){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d5,b4){d5.__proto__=b4}||function(d5,b4){for(var p4 in b4)Object.prototype.hasOwnProperty.call(b4,p4)&&(d5[p4]=b4[p4])},extendStatics(d4,b3)};function __extends(d4,b3){if(typeof b3!="function"&&b3!==null)throw new TypeError("Class extends value "+String(b3)+" is not a constructor or null");extendStatics(d4,b3);function __2(){this.constructor=d4}d4.prototype=b3===null?Object.create(b3):(__2.prototype=b3.prototype,new __2)}var __assign=function(){return __assign=Object.assign||function(t52){for(var s3,i3=1,n4=arguments.length;i3<n4;i3++){s3=arguments[i3];for(var p4 in s3)Object.prototype.hasOwnProperty.call(s3,p4)&&(t52[p4]=s3[p4])}return t52},__assign.apply(this,arguments)};function __rest(s3,e5){var t52={};for(var p4 in s3)Object.prototype.hasOwnProperty.call(s3,p4)&&e5.indexOf(p4)<0&&(t52[p4]=s3[p4]);if(s3!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i3=0,p4=Object.getOwnPropertySymbols(s3);i3<p4.length;i3++)e5.indexOf(p4[i3])<0&&Object.prototype.propertyIsEnumerable.call(s3,p4[i3])&&(t52[p4[i3]]=s3[p4[i3]]);return t52}function __decorate(decorators,target,key,desc){var c4=arguments.length,r5=c4<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d4;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r5=Reflect.decorate(decorators,target,key,desc);else for(var i3=decorators.length-1;i3>=0;i3--)(d4=decorators[i3])&&(r5=(c4<3?d4(r5):c4>3?d4(target,key,r5):d4(target,key))||r5);return c4>3&&r5&&Object.defineProperty(target,key,r5),r5}function __param(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}}function __esDecorate(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f3){if(f3!==void 0&&typeof f3!="function")throw new TypeError("Function expected");return f3}for(var kind=contextIn.kind,key=kind==="getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),_4,done=!1,i3=decorators.length-1;i3>=0;i3--){var context={};for(var p4 in contextIn)context[p4]=p4==="access"?{}:contextIn[p4];for(var p4 in contextIn.access)context.access[p4]=contextIn.access[p4];context.addInitializer=function(f3){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f3||null))};var result=(0,decorators[i3])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_4=accept(result.get))&&(descriptor.get=_4),(_4=accept(result.set))&&(descriptor.set=_4),(_4=accept(result.init))&&initializers.unshift(_4)}else(_4=accept(result))&&(kind==="field"?initializers.unshift(_4):descriptor[key]=_4)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0}function __runInitializers(thisArg,initializers,value){for(var useValue=arguments.length>2,i3=0;i3<initializers.length;i3++)value=useValue?initializers[i3].call(thisArg,value):initializers[i3].call(thisArg);return useValue?value:void 0}function __propKey(x4){return typeof x4=="symbol"?x4:"".concat(x4)}function __setFunctionName(f3,name,prefix){return typeof name=="symbol"&&(name=name.description?"[".concat(name.description,"]"):""),Object.defineProperty(f3,"name",{configurable:!0,value:prefix?"".concat(prefix," ",name):name})}function __metadata(metadataKey,metadataValue){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(metadataKey,metadataValue)}function __awaiter(thisArg,_arguments,P4,generator){function adopt(value){return value instanceof P4?value:new P4(function(resolve){resolve(value)})}return new(P4||(P4=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e5){reject(e5)}}function rejected(value){try{step(generator.throw(value))}catch(e5){reject(e5)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var _4={label:0,sent:function(){if(t52[0]&1)throw t52[1];return t52[1]},trys:[],ops:[]},f3,y4,t52,g6=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return g6.next=verb(0),g6.throw=verb(1),g6.return=verb(2),typeof Symbol=="function"&&(g6[Symbol.iterator]=function(){return this}),g6;function verb(n4){return function(v4){return step([n4,v4])}}function step(op3){if(f3)throw new TypeError("Generator is already executing.");for(;g6&&(g6=0,op3[0]&&(_4=0)),_4;)try{if(f3=1,y4&&(t52=op3[0]&2?y4.return:op3[0]?y4.throw||((t52=y4.return)&&t52.call(y4),0):y4.next)&&!(t52=t52.call(y4,op3[1])).done)return t52;switch(y4=0,t52&&(op3=[op3[0]&2,t52.value]),op3[0]){case 0:case 1:t52=op3;break;case 4:return _4.label++,{value:op3[1],done:!1};case 5:_4.label++,y4=op3[1],op3=[0];continue;case 7:op3=_4.ops.pop(),_4.trys.pop();continue;default:if(t52=_4.trys,!(t52=t52.length>0&&t52[t52.length-1])&&(op3[0]===6||op3[0]===2)){_4=0;continue}if(op3[0]===3&&(!t52||op3[1]>t52[0]&&op3[1]<t52[3])){_4.label=op3[1];break}if(op3[0]===6&&_4.label<t52[1]){_4.label=t52[1],t52=op3;break}if(t52&&_4.label<t52[2]){_4.label=t52[2],_4.ops.push(op3);break}t52[2]&&_4.ops.pop(),_4.trys.pop();continue}op3=body.call(thisArg,_4)}catch(e5){op3=[6,e5],y4=0}finally{f3=t52=0}if(op3[0]&5)throw op3[1];return{value:op3[0]?op3[1]:void 0,done:!0}}}var __createBinding=Object.create?(function(o4,m4,k4,k22){k22===void 0&&(k22=k4);var desc=Object.getOwnPropertyDescriptor(m4,k4);(!desc||("get"in desc?!m4.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m4[k4]}}),Object.defineProperty(o4,k22,desc)}):(function(o4,m4,k4,k22){k22===void 0&&(k22=k4),o4[k22]=m4[k4]});function __exportStar(m4,o4){for(var p4 in m4)p4!=="default"&&!Object.prototype.hasOwnProperty.call(o4,p4)&&__createBinding(o4,m4,p4)}function __values(o4){var s3=typeof Symbol=="function"&&Symbol.iterator,m4=s3&&o4[s3],i3=0;if(m4)return m4.call(o4);if(o4&&typeof o4.length=="number")return{next:function(){return o4&&i3>=o4.length&&(o4=void 0),{value:o4&&o4[i3++],done:!o4}}};throw new TypeError(s3?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o4,n4){var m4=typeof Symbol=="function"&&o4[Symbol.iterator];if(!m4)return o4;var i3=m4.call(o4),r5,ar3=[],e5;try{for(;(n4===void 0||n4-- >0)&&!(r5=i3.next()).done;)ar3.push(r5.value)}catch(error2){e5={error:error2}}finally{try{r5&&!r5.done&&(m4=i3.return)&&m4.call(i3)}finally{if(e5)throw e5.error}}return ar3}function __spread(){for(var ar3=[],i3=0;i3<arguments.length;i3++)ar3=ar3.concat(__read(arguments[i3]));return ar3}function __spreadArrays(){for(var s3=0,i3=0,il3=arguments.length;i3<il3;i3++)s3+=arguments[i3].length;for(var r5=Array(s3),k4=0,i3=0;i3<il3;i3++)for(var a3=arguments[i3],j4=0,jl3=a3.length;j4<jl3;j4++,k4++)r5[k4]=a3[j4];return r5}function __spreadArray(to3,from,pack2){if(pack2||arguments.length===2)for(var i3=0,l4=from.length,ar3;i3<l4;i3++)(ar3||!(i3 in from))&&(ar3||(ar3=Array.prototype.slice.call(from,0,i3)),ar3[i3]=from[i3]);return to3.concat(ar3||Array.prototype.slice.call(from))}function __await(v4){return this instanceof __await?(this.v=v4,this):new __await(v4)}function __asyncGenerator(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g6=generator.apply(thisArg,_arguments||[]),i3,q4=[];return i3=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),verb("next"),verb("throw"),verb("return",awaitReturn),i3[Symbol.asyncIterator]=function(){return this},i3;function awaitReturn(f3){return function(v4){return Promise.resolve(v4).then(f3,reject)}}function verb(n4,f3){g6[n4]&&(i3[n4]=function(v4){return new Promise(function(a3,b3){q4.push([n4,v4,a3,b3])>1||resume(n4,v4)})},f3&&(i3[n4]=f3(i3[n4])))}function resume(n4,v4){try{step(g6[n4](v4))}catch(e5){settle(q4[0][3],e5)}}function step(r5){r5.value instanceof __await?Promise.resolve(r5.value.v).then(fulfill,reject):settle(q4[0][2],r5)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f3,v4){f3(v4),q4.shift(),q4.length&&resume(q4[0][0],q4[0][1])}}function __asyncDelegator(o4){var i3,p4;return i3={},verb("next"),verb("throw",function(e5){throw e5}),verb("return"),i3[Symbol.iterator]=function(){return this},i3;function verb(n4,f3){i3[n4]=o4[n4]?function(v4){return(p4=!p4)?{value:__await(o4[n4](v4)),done:!1}:f3?f3(v4):v4}:f3}}function __asyncValues(o4){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m4=o4[Symbol.asyncIterator],i3;return m4?m4.call(o4):(o4=typeof __values=="function"?__values(o4):o4[Symbol.iterator](),i3={},verb("next"),verb("throw"),verb("return"),i3[Symbol.asyncIterator]=function(){return this},i3);function verb(n4){i3[n4]=o4[n4]&&function(v4){return new Promise(function(resolve,reject){v4=o4[n4](v4),settle(resolve,reject,v4.done,v4.value)})}}function settle(resolve,reject,d4,v4){Promise.resolve(v4).then(function(v5){resolve({value:v5,done:d4})},reject)}}function __makeTemplateObject(cooked,raw){return Object.defineProperty?Object.defineProperty(cooked,"raw",{value:raw}):cooked.raw=raw,cooked}var __setModuleDefault=Object.create?(function(o4,v4){Object.defineProperty(o4,"default",{enumerable:!0,value:v4})}):function(o4,v4){o4.default=v4},ownKeys=function(o4){return ownKeys=Object.getOwnPropertyNames||function(o6){var ar3=[];for(var k4 in o6)Object.prototype.hasOwnProperty.call(o6,k4)&&(ar3[ar3.length]=k4);return ar3},ownKeys(o4)};function __importStar(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k4=ownKeys(mod),i3=0;i3<k4.length;i3++)k4[i3]!=="default"&&__createBinding(result,mod,k4[i3]);return __setModuleDefault(result,mod),result}function __importDefault(mod){return mod&&mod.__esModule?mod:{default:mod}}function __classPrivateFieldGet(receiver,state2,kind,f3){if(kind==="a"&&!f3)throw new TypeError("Private accessor was defined without a getter");if(typeof state2=="function"?receiver!==state2||!f3:!state2.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f3:kind==="a"?f3.call(receiver):f3?f3.value:state2.get(receiver)}function __classPrivateFieldSet(receiver,state2,value,kind,f3){if(kind==="m")throw new TypeError("Private method is not writable");if(kind==="a"&&!f3)throw new TypeError("Private accessor was defined without a setter");if(typeof state2=="function"?receiver!==state2||!f3:!state2.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return kind==="a"?f3.call(receiver,value):f3?f3.value=value:state2.set(receiver,value),value}function __classPrivateFieldIn(state2,receiver){if(receiver===null||typeof receiver!="object"&&typeof receiver!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof state2=="function"?receiver===state2:state2.has(receiver)}function __addDisposableResource(env,value,async){if(value!=null){if(typeof value!="object"&&typeof value!="function")throw new TypeError("Object expected.");var dispose,inner;if(async){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");dispose=value[Symbol.asyncDispose]}if(dispose===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");dispose=value[Symbol.dispose],async&&(inner=dispose)}if(typeof dispose!="function")throw new TypeError("Object not disposable.");inner&&(dispose=function(){try{inner.call(this)}catch(e5){return Promise.reject(e5)}}),env.stack.push({value,dispose,async})}else async&&env.stack.push({async:!0});return value}var _SuppressedError=typeof SuppressedError=="function"?SuppressedError:function(error2,suppressed,message){var e5=new Error(message);return e5.name="SuppressedError",e5.error=error2,e5.suppressed=suppressed,e5};function __disposeResources(env){function fail(e5){env.error=env.hasError?new _SuppressedError(e5,env.error,"An error was suppressed during disposal."):e5,env.hasError=!0}var r5,s3=0;function next2(){for(;r5=env.stack.pop();)try{if(!r5.async&&s3===1)return s3=0,env.stack.push(r5),Promise.resolve().then(next2);if(r5.dispose){var result=r5.dispose.call(r5.value);if(r5.async)return s3|=2,Promise.resolve(result).then(next2,function(e5){return fail(e5),next2()})}else s3|=1}catch(e5){fail(e5)}if(s3===1)return env.hasError?Promise.reject(env.error):Promise.resolve();if(env.hasError)throw env.error}return next2()}function __rewriteRelativeImportExtension(path,preserveJsx){return typeof path=="string"&&/^\.\.?\//.test(path)?path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(m4,tsx,d4,ext,cm3){return tsx?preserveJsx?".jsx":".js":d4&&(!ext||!cm3)?m4:d4+ext+"."+cm3.toLowerCase()+"js"}):path}var tslib_es6_default={__extends,__assign,__rest,__decorate,__param,__esDecorate,__runInitializers,__propKey,__setFunctionName,__metadata,__awaiter,__generator,__createBinding,__exportStar,__values,__read,__spread,__spreadArrays,__spreadArray,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault,__classPrivateFieldGet,__classPrivateFieldSet,__classPrivateFieldIn,__addDisposableResource,__disposeResources,__rewriteRelativeImportExtension};var import_debug22=__toESM(require_browser(),1),debug12=(0,import_debug22.default)("tsci:eval:execution-context");function createExecutionContext(webWorkerConfiguration,opts={}){globalThis.React=React;let basePlatform=opts.platform||getPlatformConfig({},{easyEdaProxyConfig:webWorkerConfiguration.easyEdaProxyConfig}),platform=opts.projectConfig?{...basePlatform,...opts.projectConfig}:basePlatform;platform.partsEngineDisabled&&(platform.partsEngine=void 0);let circuit=new RootCircuit({platform});opts.name&&(circuit.name=opts.name),opts.debugNamespace&&circuit.enableDebug(opts.debugNamespace);let logs=[];return{fsMap:{},entrypoint:"",logger:{info:message=>{logs.push({msg:message})},getLogs:()=>logs,stringifyLogs:()=>logs.map(log=>log.msg).join(`
|
|
709
710
|
`)},preSuppliedImports:{"@tscircuit/core":dist_exports4,tscircuit:dist_exports4,"@tscircuit/math-utils":dist_exports2,"@tscircuit/mm":dist_exports5,react:React,"react/jsx-runtime":ReactJsxRuntime,debug:import_debug22.default,tslib:tslib_es6_exports,"@tscircuit/props":{}},circuit,tsConfig:null,importStack:[],currentlyImporting:new Set,...webWorkerConfiguration}}function normalizeFilePath(filePath){let normFilePath=filePath;return normFilePath=normFilePath.replace(/\\/g,"/"),normFilePath=normFilePath.trim(),normFilePath.startsWith("./")&&(normFilePath=normFilePath.slice(2)),normFilePath.startsWith("/")&&(normFilePath=normFilePath.slice(1)),normFilePath}function normalizeFsMap(fsMap){let normalizedFsMap={};for(let[fsPath,fileContent]of Object.entries(fsMap))normalizedFsMap[normalizeFilePath(fsPath)]=fileContent;return normalizedFsMap}function dirname(path){if(!path)return".";let cleanPath=path.replace(/\\/g,"/").replace(/\/+$/,"");return cleanPath.indexOf("/")===-1?".":cleanPath.substring(0,cleanPath.lastIndexOf("/"))||"/"}function resolveRelativePath(importPath,cwd){if(importPath.startsWith("../")){let parentDir=dirname(cwd);return resolveRelativePath(importPath.slice(3),parentDir)}return importPath.startsWith("./")?resolveRelativePath(importPath.slice(2),cwd):importPath.startsWith("/")?importPath.slice(1):`${cwd}/${importPath}`}function getTsConfig(fsMapOrAllFilePaths){if(Array.isArray(fsMapOrAllFilePaths))return null;let tsconfigContent=fsMapOrAllFilePaths["tsconfig.json"];if(!tsconfigContent)return null;try{let sanitizedContent=tsconfigContent.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"");return JSON.parse(sanitizedContent)}catch(e5){throw new Error(`Failed to parse tsconfig.json: ${e5.message}`)}}function resolveWithTsconfigPaths(opts){let{importPath,normalizedFilePathMap,extensions,tsConfig,tsconfigDir}=opts,paths=tsConfig?.compilerOptions?.paths;if(!paths)return null;let baseUrl=tsConfig?.compilerOptions?.baseUrl||".",tryResolveCandidate=candidate=>{let normalizedCandidate=normalizeFilePath(candidate);if(normalizedFilePathMap.has(normalizedCandidate))return normalizedFilePathMap.get(normalizedCandidate);for(let ext of extensions){let withExt=`${normalizedCandidate}.${ext}`;if(normalizedFilePathMap.has(withExt))return normalizedFilePathMap.get(withExt)}return null};for(let[alias,targets]of Object.entries(paths))if(alias.includes("*")){let[prefix,suffix]=alias.split("*");if(!importPath.startsWith(prefix)||!importPath.endsWith(suffix||""))continue;let starMatch=importPath.slice(prefix.length,importPath.length-(suffix?suffix.length:0));for(let target of targets){let replaced=target.replace("*",starMatch),candidate=baseUrl&&!replaced.startsWith("./")&&!replaced.startsWith("/")?`${baseUrl}/${replaced}`:replaced,resolved=tryResolveCandidate(candidate);if(resolved)return resolved}}else{if(importPath!==alias)continue;for(let target of targets){let candidate=baseUrl&&!target.startsWith("./")&&!target.startsWith("/")?`${baseUrl}/${target}`:target,resolved=tryResolveCandidate(candidate);if(resolved)return resolved}}let resolvedPathFromBaseUrl=resolveWithBaseUrl({importPath,normalizedFilePathMap,extensions,tsConfig,tsconfigDir});return resolvedPathFromBaseUrl||null}function resolveWithBaseUrl(opts){let{importPath,normalizedFilePathMap,extensions,tsConfig,tsconfigDir}=opts,baseUrl=tsConfig?.compilerOptions?.baseUrl;if(!baseUrl)return null;let filePathToResolve=`${tsconfigDir||"."}/${baseUrl}/${importPath}`;filePathToResolve=filePathToResolve.replace(/\/+/g,"/"),filePathToResolve=filePathToResolve.replace(/\/\.\//g,"/");let normalizedFilePath=normalizeFilePath(filePathToResolve);if(normalizedFilePathMap.has(normalizedFilePath))return normalizedFilePathMap.get(normalizedFilePath);for(let ext of extensions){let withExt=`${normalizedFilePath}.${ext}`;if(normalizedFilePathMap.has(withExt))return normalizedFilePathMap.get(withExt)}return null}function matchesTsconfigPathPattern(importPath,tsConfig){let paths=tsConfig?.compilerOptions?.paths;if(!paths)return!1;for(let[alias]of Object.entries(paths))if(alias.includes("*")){let[prefix,suffix]=alias.split("*");if(importPath.startsWith(prefix)&&importPath.endsWith(suffix||""))return!0}else if(importPath===alias)return!0;return!1}var FILE_EXTENSIONS=["tsx","ts","json","js","jsx","obj","gltf","glb","stl","step","stp"],resolveFilePath=(unknownFilePath,fsMapOrAllFilePaths,cwd,opts={})=>{let tsConfig=opts.tsConfig??null,isRelativeImport=unknownFilePath.startsWith("./")||unknownFilePath.startsWith("../"),hasBaseUrl=!!tsConfig?.compilerOptions?.baseUrl,resolvedPath=cwd&&(isRelativeImport||!hasBaseUrl)?resolveRelativePath(unknownFilePath,cwd):unknownFilePath,filePaths=new Set(Array.isArray(fsMapOrAllFilePaths)?fsMapOrAllFilePaths:Object.keys(fsMapOrAllFilePaths));if(filePaths.has(resolvedPath))return resolvedPath;let normalizedFilePathMap=new Map;for(let filePath of filePaths)normalizedFilePathMap.set(normalizeFilePath(filePath),filePath);let normalizedResolvedPath=normalizeFilePath(resolvedPath);if(isRelativeImport||!hasBaseUrl){if(normalizedFilePathMap.has(normalizedResolvedPath))return normalizedFilePathMap.get(normalizedResolvedPath);for(let ext of FILE_EXTENSIONS){let possibleFilePath=`${normalizedResolvedPath}.${ext}`;if(normalizedFilePathMap.has(possibleFilePath))return normalizedFilePathMap.get(possibleFilePath)}}if(!isRelativeImport){let resolvedPathFromPaths=resolveWithTsconfigPaths({importPath:unknownFilePath,normalizedFilePathMap,extensions:FILE_EXTENSIONS,tsConfig,tsconfigDir:opts.tsconfigDir});if(resolvedPathFromPaths)return resolvedPathFromPaths;let resolvedPathFromBaseUrl=resolveWithBaseUrl({importPath:unknownFilePath,normalizedFilePathMap,extensions:FILE_EXTENSIONS,tsConfig,tsconfigDir:opts.tsconfigDir});if(resolvedPathFromBaseUrl)return resolvedPathFromBaseUrl}if(!isRelativeImport&&!hasBaseUrl){let normalizedUnknownFilePath=normalizeFilePath(unknownFilePath);if(normalizedFilePathMap.has(normalizedUnknownFilePath))return normalizedFilePathMap.get(normalizedUnknownFilePath);for(let ext of FILE_EXTENSIONS){let possibleFilePath=`${normalizedUnknownFilePath}.${ext}`;if(normalizedFilePathMap.has(possibleFilePath))return normalizedFilePathMap.get(possibleFilePath)}}return null},resolveFilePathOrThrow=(unknownFilePath,fsMapOrAllFilePaths,cwd,opts={})=>{let resolvedFilePath=resolveFilePath(unknownFilePath,fsMapOrAllFilePaths,cwd,opts);if(!resolvedFilePath)throw new Error(`File not found "${unknownFilePath}", available paths:
|
|
710
711
|
|
|
711
712
|
${Object.keys(fsMapOrAllFilePaths).join(", ")}`);return resolvedFilePath};var stripComments=code=>{let out="",i3=0,inSingle=!1,inDouble=!1,inTemplate=!1;for(;i3<code.length;){let ch3=code[i3],next2=code[i3+1];if(!inDouble&&!inTemplate&&ch3==="'"&&code[i3-1]!=="\\"){inSingle=!inSingle,out+=ch3,i3++;continue}if(!inSingle&&!inTemplate&&ch3==='"'&&code[i3-1]!=="\\"){inDouble=!inDouble,out+=ch3,i3++;continue}if(!inSingle&&!inDouble&&ch3==="`"&&code[i3-1]!=="\\"){inTemplate=!inTemplate,out+=ch3,i3++;continue}if(!inSingle&&!inDouble&&!inTemplate){if(ch3==="/"&&next2==="/"){for(out+=" ",i3+=2;i3<code.length&&code[i3]!==`
|
|
@@ -917,7 +918,7 @@ ${namesToRegister.map(({variableName,uniqueLocalName})=>` reactHotLoader.regist
|
|
|
917
918
|
`)}},__publicField(_a400,"token","layer"),__publicField(_a400,"parentToken","stackup"),_a400);SxClass.register(StackupLayer);var _a401,Stackup=(_a401=class extends SxClass{constructor(opts={}){super();__publicField(this,"token","stackup");__publicField(this,"_layers",[]);__publicField(this,"_sxCopperFinish");__publicField(this,"_sxDielectricConstraints");__publicField(this,"_sxEdgeConnector");__publicField(this,"_sxCastellatedPads");__publicField(this,"_sxEdgePlating");this.layers=opts.layers??[],this._sxCopperFinish=opts.copperFinish,this._sxDielectricConstraints=opts.dielectricConstraints,this._sxEdgeConnector=opts.edgeConnector,this._sxCastellatedPads=opts.castellatedPads,this._sxEdgePlating=opts.edgePlating}static fromSexprPrimitives(primitiveSexprs){let{propertyMap,arrayPropertyMap}=SxClass.parsePrimitivesToClassProperties(primitiveSexprs,this.token);return new _a401({layers:arrayPropertyMap.layer??[],copperFinish:propertyMap.copper_finish,dielectricConstraints:propertyMap.dielectric_constraints,edgeConnector:propertyMap.edge_connector,castellatedPads:propertyMap.castellated_pads,edgePlating:propertyMap.edge_plating})}get layers(){return[...this._layers]}set layers(layers){this._layers=layers.map(layer=>{if(!(layer instanceof StackupLayer))throw new Error("Stackup layers must be StackupLayer instances");return layer})}get copperFinish(){return this._sxCopperFinish?.value}set copperFinish(value){this._sxCopperFinish=value?new StackupCopperFinish(value):void 0}get dielectricConstraints(){return this._sxDielectricConstraints?.value}set dielectricConstraints(value){this._sxDielectricConstraints=value?new StackupDielectricConstraints(value):void 0}get edgeConnector(){return this._sxEdgeConnector?.value}set edgeConnector(value){this._sxEdgeConnector=value?new StackupEdgeConnector(value):void 0}get castellatedPads(){return this._sxCastellatedPads?.value}set castellatedPads(value){this._sxCastellatedPads=value?new StackupCastellatedPads(value):void 0}get edgePlating(){return this._sxEdgePlating?.value}set edgePlating(value){this._sxEdgePlating=value?new StackupEdgePlating(value):void 0}getChildren(){let children=[...this._layers],optionalChildren=[this._sxCopperFinish,this._sxDielectricConstraints,this._sxEdgeConnector,this._sxCastellatedPads,this._sxEdgePlating];for(let child of optionalChildren)child&&children.push(child);return children}},__publicField(_a401,"token","stackup"),__publicField(_a401,"parentToken","setup"),_a401);SxClass.register(Stackup);var TOKEN_TO_KEY2={stackup:"stackup",pcbplotparams:"pcbPlotParams",pad_to_mask_clearance:"padToMaskClearance",solder_mask_min_width:"solderMaskMinWidth",pad_to_paste_clearance:"padToPasteClearance",pad_to_paste_clearance_ratio:"padToPasteClearanceRatio",last_trace_width:"lastTraceWidth",trace_clearance:"traceClearance",zone_clearance:"zoneClearance",zone_45_only:"zone45Only",trace_min:"traceMin",segment_width:"segmentWidth",edge_width:"edgeWidth",via_size:"viaSize",via_drill:"viaDrill",via_min_size:"viaMinSize",via_min_drill:"viaMinDrill",uvias_allowed:"uviasAllowed",uvia_size:"uviaSize",uvia_drill:"uviaDrill",uvia_min_size:"uviaMinSize",uvia_min_drill:"uviaMinDrill",pcb_text_width:"pcbTextWidth",pcb_text_size:"pcbTextSize",mod_edge_width:"modEdgeWidth",mod_text_size:"modTextSize",mod_text_width:"modTextWidth",pad_size:"padSize",pad_drill:"padDrill",allow_soldermask_bridges_in_footprints:"allowSoldermaskBridgesInFootprints",tenting:"tenting",aux_axis_origin:"auxAxisOrigin",grid_origin:"gridOrigin",visible_elements:"visibleElements",pad_to_paste_clearance_values:"padToPasteClearanceValues",trace_width:"traceWidth"},SETUP_CHILD_ORDER=["stackup","padToMaskClearance","solderMaskMinWidth","padToPasteClearance","padToPasteClearanceRatio","lastTraceWidth","traceClearance","zoneClearance","zone45Only","traceMin","segmentWidth","edgeWidth","viaSize","viaDrill","viaMinSize","viaMinDrill","uviaSize","uviaDrill","uviasAllowed","uviaMinSize","uviaMinDrill","pcbTextWidth","pcbTextSize","modEdgeWidth","modTextSize","modTextWidth","padSize","padDrill","allowSoldermaskBridgesInFootprints","tenting","auxAxisOrigin","gridOrigin","visibleElements","padToPasteClearanceValues","traceWidth","pcbPlotParams"],_a402,Setup=(_a402=class extends SxClass{constructor(){super(...arguments);__publicField(this,"token","setup");__publicField(this,"_properties",{})}static fromSexprPrimitives(primitiveSexprs){let setup=new _a402,{propertyMap}=SxClass.parsePrimitivesToClassProperties(primitiveSexprs,this.token);for(let[token,instance]of Object.entries(propertyMap)){let key=TOKEN_TO_KEY2[token];if(!key)throw new Error(`Unsupported setup property token: ${token}`);setup._properties[key]=instance}return setup}getChildren(){let children=[];for(let key of SETUP_CHILD_ORDER){let child=this._properties[key];child&&children.push(child)}return children}setProperty(key,instance){if(instance){this._properties[key]=instance;return}delete this._properties[key]}setNumberProperty(key,value,ClassRef){if(value===void 0){delete this._properties[key];return}this._properties[key]=new ClassRef(value)}getPropertyInstance(key,ClassRef){let value=this._properties[key];return value instanceof ClassRef?value:void 0}get stackup(){return this.getPropertyInstance("stackup",Stackup)}set stackup(value){if(value!==void 0&&!(value instanceof Stackup))throw new Error("stackup must be a Stackup instance");this.setProperty("stackup",value)}get pcbPlotParams(){return this.getPropertyInstance("pcbPlotParams",PcbPlotParams)}set pcbPlotParams(value){if(value!==void 0&&!(value instanceof PcbPlotParams))throw new Error("pcbPlotParams must be a PcbPlotParams instance");this.setProperty("pcbPlotParams",value)}get padToMaskClearance(){return this.getPropertyInstance("padToMaskClearance",SetupPadToMaskClearance)?.value}set padToMaskClearance(value){this.setNumberProperty("padToMaskClearance",value,SetupPadToMaskClearance)}get solderMaskMinWidth(){return this.getPropertyInstance("solderMaskMinWidth",SetupSolderMaskMinWidth)?.value}set solderMaskMinWidth(value){this.setNumberProperty("solderMaskMinWidth",value,SetupSolderMaskMinWidth)}get padToPasteClearance(){return this.getPropertyInstance("padToPasteClearance",SetupPadToPasteClearance)?.value}set padToPasteClearance(value){this.setNumberProperty("padToPasteClearance",value,SetupPadToPasteClearance)}get padToPasteClearanceRatio(){return this.getPropertyInstance("padToPasteClearanceRatio",SetupPadToPasteClearanceRatio)?.value}set padToPasteClearanceRatio(value){this.setNumberProperty("padToPasteClearanceRatio",value,SetupPadToPasteClearanceRatio)}get lastTraceWidth(){return this.getPropertyInstance("lastTraceWidth",SetupLastTraceWidth)?.value}set lastTraceWidth(value){this.setNumberProperty("lastTraceWidth",value,SetupLastTraceWidth)}get traceClearance(){return this.getPropertyInstance("traceClearance",SetupTraceClearance)?.value}set traceClearance(value){this.setNumberProperty("traceClearance",value,SetupTraceClearance)}get zoneClearance(){return this.getPropertyInstance("zoneClearance",SetupZoneClearance)?.value}set zoneClearance(value){this.setNumberProperty("zoneClearance",value,SetupZoneClearance)}get zone45Only(){return this.getPropertyInstance("zone45Only",SetupZone45Only)?.value}set zone45Only(value){this.setProperty("zone45Only",value===void 0?void 0:new SetupZone45Only(value))}get traceMin(){return this.getPropertyInstance("traceMin",SetupTraceMin)?.value}set traceMin(value){this.setNumberProperty("traceMin",value,SetupTraceMin)}get segmentWidth(){return this.getPropertyInstance("segmentWidth",SetupSegmentWidth)?.value}set segmentWidth(value){this.setNumberProperty("segmentWidth",value,SetupSegmentWidth)}get edgeWidth(){return this.getPropertyInstance("edgeWidth",SetupEdgeWidth)?.value}set edgeWidth(value){this.setNumberProperty("edgeWidth",value,SetupEdgeWidth)}get viaSize(){return this.getPropertyInstance("viaSize",SetupViaSize)?.value}set viaSize(value){this.setNumberProperty("viaSize",value,SetupViaSize)}get viaDrill(){return this.getPropertyInstance("viaDrill",SetupViaDrill)?.value}set viaDrill(value){this.setNumberProperty("viaDrill",value,SetupViaDrill)}get viaMinSize(){return this.getPropertyInstance("viaMinSize",SetupViaMinSize)?.value}set viaMinSize(value){this.setNumberProperty("viaMinSize",value,SetupViaMinSize)}get viaMinDrill(){return this.getPropertyInstance("viaMinDrill",SetupViaMinDrill)?.value}set viaMinDrill(value){this.setNumberProperty("viaMinDrill",value,SetupViaMinDrill)}get uviasAllowed(){return this.getPropertyInstance("uviasAllowed",SetupUviasAllowed)?.value}set uviasAllowed(value){this.setProperty("uviasAllowed",value===void 0?void 0:new SetupUviasAllowed(value))}get uviaSize(){return this.getPropertyInstance("uviaSize",SetupUviaSize)?.value}set uviaSize(value){this.setNumberProperty("uviaSize",value,SetupUviaSize)}get uviaDrill(){return this.getPropertyInstance("uviaDrill",SetupUviaDrill)?.value}set uviaDrill(value){this.setNumberProperty("uviaDrill",value,SetupUviaDrill)}get uviaMinSize(){return this.getPropertyInstance("uviaMinSize",SetupUviaMinSize)?.value}set uviaMinSize(value){this.setNumberProperty("uviaMinSize",value,SetupUviaMinSize)}get uviaMinDrill(){return this.getPropertyInstance("uviaMinDrill",SetupUviaMinDrill)?.value}set uviaMinDrill(value){this.setNumberProperty("uviaMinDrill",value,SetupUviaMinDrill)}get pcbTextWidth(){return this.getPropertyInstance("pcbTextWidth",SetupPcbTextWidth)?.value}set pcbTextWidth(value){this.setNumberProperty("pcbTextWidth",value,SetupPcbTextWidth)}get pcbTextSize(){return this.getPropertyInstance("pcbTextSize",SetupPcbTextSize)?.values}set pcbTextSize(values){if(values===void 0){delete this._properties.pcbTextSize;return}this.setProperty("pcbTextSize",new SetupPcbTextSize(values))}get modEdgeWidth(){return this.getPropertyInstance("modEdgeWidth",SetupModEdgeWidth)?.value}set modEdgeWidth(value){this.setNumberProperty("modEdgeWidth",value,SetupModEdgeWidth)}get modTextSize(){return this.getPropertyInstance("modTextSize",SetupModTextSize)?.values}set modTextSize(values){if(values===void 0){delete this._properties.modTextSize;return}this.setProperty("modTextSize",new SetupModTextSize(values))}get modTextWidth(){return this.getPropertyInstance("modTextWidth",SetupModTextWidth)?.value}set modTextWidth(value){this.setNumberProperty("modTextWidth",value,SetupModTextWidth)}get padSize(){return this.getPropertyInstance("padSize",SetupPadSize)?.values}set padSize(values){if(values===void 0){delete this._properties.padSize;return}this.setProperty("padSize",new SetupPadSize(values))}get padDrill(){return this.getPropertyInstance("padDrill",SetupPadDrill)?.value}set padDrill(value){this.setNumberProperty("padDrill",value,SetupPadDrill)}get allowSoldermaskBridgesInFootprints(){return this.getPropertyInstance("allowSoldermaskBridgesInFootprints",SetupAllowSoldermaskBridgesInFootprints)?.value}set allowSoldermaskBridgesInFootprints(value){this.setProperty("allowSoldermaskBridgesInFootprints",value===void 0?void 0:new SetupAllowSoldermaskBridgesInFootprints(value))}get tenting(){return this.getPropertyInstance("tenting",SetupTenting)?.sides}set tenting(sides){if(sides===void 0){delete this._properties.tenting;return}this.setProperty("tenting",new SetupTenting(sides))}get auxAxisOrigin(){let origin=this.getPropertyInstance("auxAxisOrigin",SetupAuxAxisOrigin);if(origin)return{x:origin.x,y:origin.y}}set auxAxisOrigin(origin){if(!origin){delete this._properties.auxAxisOrigin;return}this.setProperty("auxAxisOrigin",new SetupAuxAxisOrigin(origin.x,origin.y))}get gridOrigin(){let origin=this.getPropertyInstance("gridOrigin",SetupGridOrigin);if(origin)return{x:origin.x,y:origin.y}}set gridOrigin(origin){if(!origin){delete this._properties.gridOrigin;return}this.setProperty("gridOrigin",new SetupGridOrigin(origin.x,origin.y))}get visibleElements(){return this.getPropertyInstance("visibleElements",SetupVisibleElements)?.value}set visibleElements(value){this.setProperty("visibleElements",value===void 0?void 0:new SetupVisibleElements(value))}get padToPasteClearanceValues(){return this.getPropertyInstance("padToPasteClearanceValues",SetupPadToPasteClearanceValues)?.values}set padToPasteClearanceValues(values){if(values===void 0){delete this._properties.padToPasteClearanceValues;return}this.setProperty("padToPasteClearanceValues",new SetupPadToPasteClearanceValues(values))}get traceWidth(){return this.getPropertyInstance("traceWidth",SetupTraceWidth)?.values}set traceWidth(values){if(values===void 0){delete this._properties.traceWidth;return}this.setProperty("traceWidth",new SetupTraceWidth(values))}},__publicField(_a402,"token","setup"),_a402);SxClass.register(Setup);var _a403,PcbGeneralThickness=(_a403=class extends SxPrimitiveNumber{constructor(){super(...arguments);__publicField(this,"token","thickness")}},__publicField(_a403,"token","thickness"),__publicField(_a403,"parentToken","general"),_a403);SxClass.register(PcbGeneralThickness);var _a404,PcbGeneralLegacyTeardrops=(_a404=class extends SxClass{constructor(enabled){super();__publicField(this,"token","legacy_teardrops");__publicField(this,"_enabled");this._enabled=enabled}static fromSexprPrimitives(primitiveSexprs){let value=toStringValue(primitiveSexprs[0]);if(value===void 0)throw new Error("legacy_teardrops expects a string value");let enabled=/^(yes|true)$/iu.test(value);return new _a404(enabled)}get enabled(){return this._enabled}set enabled(value){this._enabled=value}getChildren(){return[]}getString(){return`(legacy_teardrops ${this._enabled?"yes":"no"})`}},__publicField(_a404,"token","legacy_teardrops"),__publicField(_a404,"parentToken","general"),_a404);SxClass.register(PcbGeneralLegacyTeardrops);var SINGLE_TOKENS3=new Set(["thickness","legacy_teardrops"]),_a405,PcbGeneral=(_a405=class extends SxClass{constructor(){super(...arguments);__publicField(this,"token","general");__publicField(this,"_sxThickness");__publicField(this,"_sxLegacyTeardrops")}static fromSexprPrimitives(primitiveSexprs){let general=new _a405,{propertyMap,arrayPropertyMap}=SxClass.parsePrimitivesToClassProperties(primitiveSexprs,this.token);for(let token of Object.keys(propertyMap))if(!SINGLE_TOKENS3.has(token))throw new Error(`general encountered unsupported child token "${token}"`);for(let[token,entries]of Object.entries(arrayPropertyMap)){if(!SINGLE_TOKENS3.has(token))throw new Error(`general encountered unsupported child token "${token}"`);if(entries.length>1)throw new Error(`general encountered repeated child token "${token}"`)}return general._sxThickness=arrayPropertyMap.thickness?.[0]??propertyMap.thickness,general._sxLegacyTeardrops=arrayPropertyMap.legacy_teardrops?.[0]??propertyMap.legacy_teardrops,general}get thickness(){return this._sxThickness?.value}set thickness(value){this._sxThickness=value===void 0?void 0:new PcbGeneralThickness(value)}get legacyTeardrops(){return this._sxLegacyTeardrops?.enabled}set legacyTeardrops(value){if(value===void 0){this._sxLegacyTeardrops=void 0;return}this._sxLegacyTeardrops=new PcbGeneralLegacyTeardrops(value)}getChildren(){let children=[];return this._sxThickness&&children.push(this._sxThickness),this._sxLegacyTeardrops&&children.push(this._sxLegacyTeardrops),children}},__publicField(_a405,"token","general"),__publicField(_a405,"parentToken","kicad_pcb"),_a405);SxClass.register(PcbGeneral);var _a406,PcbLayerDefinition=(_a406=class extends SxClass{constructor(options){super();__publicField(this,"token","__pcb_layer_definition__");__publicField(this,"_index");__publicField(this,"_name");__publicField(this,"_type");__publicField(this,"_userName");this._index=options.index,this._name=options.name,this._type=options.type,this._userName=options.userName}static fromPrimitive(primitive){if(!Array.isArray(primitive)||primitive.length<3)throw new Error(`layers entry must be an array with at least index, name, and type: ${JSON.stringify(primitive)}`);let[rawIndex,rawName,rawType,rawUser]=primitive,index=toNumberValue(rawIndex),name=toStringValue(rawName),type=toStringValue(rawType),userName=rawUser===void 0?void 0:toStringValue(rawUser);if(index===void 0||name===void 0||type===void 0)throw new Error(`layers entry is missing required values: ${JSON.stringify(primitive)}`);return new _a406({index,name,type,userName})}get index(){return this._index}set index(value){this._index=value}get name(){return this._name}set name(value){this._name=value}get type(){return this._type}set type(value){this._type=value}get userName(){return this._userName}set userName(value){this._userName=value}getChildren(){return[]}getString(){if(this._index===void 0||this._name===void 0||this._type===void 0)return"()";let tokens=[String(this._index),quoteSExprString(this._name),this._type];return this._userName!==void 0&&tokens.push(quoteSExprString(this._userName)),`(${tokens.join(" ")})`}},__publicField(_a406,"token","__pcb_layer_definition__"),__publicField(_a406,"parentToken","layers"),_a406);SxClass.register(PcbLayerDefinition);var _a407,PcbLayers=(_a407=class extends SxClass{constructor(){super(...arguments);__publicField(this,"token","layers");__publicField(this,"_definitions",[])}static fromSexprPrimitives(primitiveSexprs){let layers=new _a407;return layers._definitions=primitiveSexprs.map(primitive=>PcbLayerDefinition.fromPrimitive(primitive)),layers}get definitions(){return[...this._definitions]}set definitions(value){this._definitions=[...value]}getChildren(){return[...this._definitions]}},__publicField(_a407,"token","layers"),__publicField(_a407,"parentToken","kicad_pcb"),_a407);SxClass.register(PcbLayers);var _a408,PcbNet=(_a408=class extends SxClass{constructor(id2,name){super();__publicField(this,"token","net");__publicField(this,"_id");__publicField(this,"_name");this._id=id2,this._name=name}static fromSexprPrimitives(primitiveSexprs){let id2=toNumberValue(primitiveSexprs[0]),name=toStringValue(primitiveSexprs[1]);if(id2===void 0||name===void 0)throw new Error("net requires numeric id and string name");return new _a408(id2,name)}get id(){return this._id}set id(value){this._id=value}get name(){return this._name}set name(value){this._name=value}getChildren(){return[]}getString(){return`(net ${this._id} ${quoteSExprString(this._name)})`}},__publicField(_a408,"token","net"),__publicField(_a408,"parentToken","kicad_pcb"),_a408);SxClass.register(PcbNet);var _a409,PcbVersion=(_a409=class extends SxPrimitiveNumber{constructor(){super(...arguments);__publicField(this,"token","version")}},__publicField(_a409,"token","version"),__publicField(_a409,"parentToken","kicad_pcb"),_a409);SxClass.register(PcbVersion);var isSymbol3=value=>/^[A-Za-z0-9._-]+$/.test(value),_a410,PcbGenerator=(_a410=class extends SxPrimitiveString{constructor(){super(...arguments);__publicField(this,"token","generator")}getString(){return`(generator ${isSymbol3(this.value)?this.value:quoteSExprString(this.value)})`}},__publicField(_a410,"token","generator"),__publicField(_a410,"parentToken","kicad_pcb"),_a410);SxClass.register(PcbGenerator);var isSymbol4=value=>/^[A-Za-z0-9._-]+$/.test(value),_a411,PcbGeneratorVersion=(_a411=class extends SxPrimitiveString{constructor(){super(...arguments);__publicField(this,"token","generator_version")}getString(){return`(generator_version ${isSymbol4(this.value)?this.value:quoteSExprString(this.value)})`}},__publicField(_a411,"token","generator_version"),__publicField(_a411,"parentToken","kicad_pcb"),_a411);SxClass.register(PcbGeneratorVersion);var _a412,ViaNet=(_a412=class extends SxClass{constructor(id2,name){super();__publicField(this,"token","net");__publicField(this,"_id");__publicField(this,"_name");this._id=id2,this._name=name}static fromSexprPrimitives(primitiveSexprs){let id2=toNumberValue(primitiveSexprs[0]);if(id2===void 0)throw new Error("via net requires a numeric id");let name=primitiveSexprs.length>1?toStringValue(primitiveSexprs[1]):void 0;return new _a412(id2,name)}get id(){return this._id}set id(value){this._id=value}get name(){return this._name}set name(value){this._name=value}getChildren(){return[]}getString(){return this._name!==void 0?`(net ${this._id} ${quoteSExprString(this._name)})`:`(net ${this._id})`}},__publicField(_a412,"token","net"),__publicField(_a412,"parentToken","via"),_a412);SxClass.register(ViaNet);var BARE_FLAGS=new Set(["locked","free","remove_unused_layers","keep_end_layers"]),_a413,Via2=(_a413=class extends SxClass{constructor(params={}){super();__publicField(this,"token","via");__publicField(this,"_type");__publicField(this,"_locked",!1);__publicField(this,"_free",!1);__publicField(this,"_removeUnusedLayers",!1);__publicField(this,"_keepEndLayers",!1);__publicField(this,"_sxAt");__publicField(this,"_size");__publicField(this,"_drill");__publicField(this,"_sxLayers");__publicField(this,"_sxNet");__publicField(this,"_sxUuid");__publicField(this,"_sxTstamp");__publicField(this,"_sxTeardrops");params.type!==void 0&&(this.type=params.type),params.locked!==void 0&&(this.locked=params.locked),params.free!==void 0&&(this.free=params.free),params.removeUnusedLayers!==void 0&&(this.removeUnusedLayers=params.removeUnusedLayers),params.keepEndLayers!==void 0&&(this.keepEndLayers=params.keepEndLayers),params.at!==void 0&&(this.at=params.at),params.size!==void 0&&(this.size=params.size),params.drill!==void 0&&(this.drill=params.drill),params.layers!==void 0&&(this.layers=params.layers),params.net!==void 0&&(this.net=params.net),params.uuid!==void 0&&(this.uuid=params.uuid),params.tstamp!==void 0&&(this.tstamp=params.tstamp),params.teardrops!==void 0&&(this.teardrops=params.teardrops)}static fromSexprPrimitives(primitiveSexprs){let via=new _a413;for(let primitive of primitiveSexprs){if(typeof primitive=="string"){via.consumeBareToken(primitive);continue}if(!Array.isArray(primitive)||primitive.length===0)throw new Error(`via encountered unsupported primitive child: ${JSON.stringify(primitive)}`);let[token,...rest]=primitive;if(typeof token!="string")throw new Error(`via encountered child with non-string token: ${JSON.stringify(primitive)}`);via.consumeNode(token,rest)}return via}consumeBareToken(token){if(token==="blind"||token==="micro"){this._type=token;return}if(!BARE_FLAGS.has(token))throw new Error(`via encountered unsupported flag "${token}"`);switch(token){case"locked":this._locked=!0;break;case"free":this._free=!0;break;case"remove_unused_layers":this._removeUnusedLayers=!0;break;case"keep_end_layers":this._keepEndLayers=!0;break}}consumeNode(token,args){switch(token){case"type":{let value=toStringValue(args[0]);if(value===void 0)throw new Error("via type expects a string value");this._type=value;return}case"locked":this._locked=this.parseYesNo(args);return;case"free":this._free=this.parseYesNo(args);return;case"remove_unused_layers":this._removeUnusedLayers=this.parseYesNo(args);return;case"keep_end_layers":this._keepEndLayers=this.parseYesNo(args);return;case"at":{let parsed=SxClass.parsePrimitiveSexpr(["at",...args],{parentToken:this.token});if(!(parsed instanceof At3))throw new Error("via failed to parse at child");this._sxAt=parsed;return}case"size":{let value=toNumberValue(args[0]);if(value===void 0)throw new Error("via size expects a numeric value");this._size=value;return}case"drill":{let value=toNumberValue(args[0]);if(value===void 0)throw new Error("via drill expects a numeric value");this._drill=value;return}case"layers":{this._sxLayers=Layers.fromSexprPrimitives(args);return}case"net":{this._sxNet=ViaNet.fromSexprPrimitives(args);return}case"teardrops":{this._sxTeardrops=PadTeardrops.fromSexprPrimitives(args);return}case"uuid":{let value=toStringValue(args[0]);if(value===void 0)throw new Error("via uuid expects a string value");this._sxUuid=new Uuid(value);return}case"tstamp":{let value=toStringValue(args[0]);if(value===void 0)throw new Error("via tstamp expects a string value");this._sxTstamp=new Tstamp(value);return}default:throw new Error(`via encountered unsupported child token "${token}"`)}}parseYesNo(args){if(args.length===0)return!0;let value=toStringValue(args[0]);if(value===void 0)throw new Error("Expected string when parsing via boolean child");return/^(yes|true)$/iu.test(value)}get type(){return this._type}set type(value){this._type=value}get locked(){return this._locked}set locked(value){this._locked=value}get free(){return this._free}set free(value){this._free=value}get removeUnusedLayers(){return this._removeUnusedLayers}set removeUnusedLayers(value){this._removeUnusedLayers=value}get keepEndLayers(){return this._keepEndLayers}set keepEndLayers(value){this._keepEndLayers=value}get at(){return this._sxAt}set at(value){this._sxAt=value!==void 0?At3.from(value):void 0}get size(){return this._size}set size(value){this._size=value}get drill(){return this._drill}set drill(value){this._drill=value}get layers(){return this._sxLayers}set layers(value){if(value===void 0){this._sxLayers=void 0;return}this._sxLayers=value instanceof Layers?value:new Layers(value)}get net(){return this._sxNet}set net(value){this._sxNet=value}get uuid(){return this._sxUuid}set uuid(value){if(value===void 0){this._sxUuid=void 0;return}this._sxUuid=value instanceof Uuid?value:new Uuid(value)}get teardrops(){return this._sxTeardrops}set teardrops(value){this._sxTeardrops=value}get tstamp(){return this._sxTstamp}set tstamp(value){if(value===void 0){this._sxTstamp=void 0;return}this._sxTstamp=value instanceof Tstamp?value:new Tstamp(value)}getChildren(){let children=[];return this._sxAt&&children.push(this._sxAt),this._sxLayers&&children.push(this._sxLayers),this._sxNet&&children.push(this._sxNet),this._sxUuid&&children.push(this._sxUuid),this._sxTstamp&&children.push(this._sxTstamp),this._sxTeardrops&&children.push(this._sxTeardrops),children}getString(){let lines=["(via"];return this._type!==void 0&&lines.push(` (type ${this._type})`),this._locked&&lines.push(" (locked)"),this._free&&lines.push(" (free)"),this._removeUnusedLayers&&lines.push(" (remove_unused_layers)"),this._keepEndLayers&&lines.push(" (keep_end_layers)"),this._sxAt&&lines.push(this._sxAt.getStringIndented()),this._size!==void 0&&lines.push(` (size ${this._size})`),this._drill!==void 0&&lines.push(` (drill ${this._drill})`),this._sxLayers&&lines.push(this._sxLayers.getStringIndented()),this._sxNet&&lines.push(this._sxNet.getStringIndented()),this._sxUuid&&lines.push(this._sxUuid.getStringIndented()),this._sxTstamp&&lines.push(this._sxTstamp.getStringIndented()),this._sxTeardrops&&lines.push(this._sxTeardrops.getStringIndented()),lines.push(")"),lines.join(`
|
|
918
919
|
`)}},__publicField(_a413,"token","via"),_a413);SxClass.register(Via2);var _a414,KicadPcb=(_a414=class extends SxClass{constructor(params={}){super();__publicField(this,"token","kicad_pcb");__publicField(this,"_sxVersion");__publicField(this,"_sxGenerator");__publicField(this,"_sxGeneratorVersion");__publicField(this,"_sxGeneral");__publicField(this,"_sxPaper");__publicField(this,"_sxTitleBlock");__publicField(this,"_sxLayers");__publicField(this,"_sxSetup");__publicField(this,"_properties",[]);__publicField(this,"_nets",[]);__publicField(this,"_footprints",[]);__publicField(this,"_images",[]);__publicField(this,"_segments",[]);__publicField(this,"_arcs",[]);__publicField(this,"_grArcs",[]);__publicField(this,"_grCircles",[]);__publicField(this,"_grCurves",[]);__publicField(this,"_grLines",[]);__publicField(this,"_grTexts",[]);__publicField(this,"_grPolys",[]);__publicField(this,"_grRects",[]);__publicField(this,"_vias",[]);__publicField(this,"_zones",[]);__publicField(this,"_sxEmbeddedFonts");__publicField(this,"_sxEmbeddedFiles");__publicField(this,"_otherChildren",[]);params.version!==void 0&&(this.version=params.version),params.generator!==void 0&&(this.generator=params.generator),params.generatorVersion!==void 0&&(this.generatorVersion=params.generatorVersion),params.general!==void 0&&(this.general=params.general),params.paper!==void 0&&(this.paper=params.paper),params.titleBlock!==void 0&&(this.titleBlock=params.titleBlock),params.layers!==void 0&&(this.layers=params.layers),params.setup!==void 0&&(this.setup=params.setup),params.properties!==void 0&&(this.properties=params.properties),params.nets!==void 0&&(this.nets=params.nets),params.footprints!==void 0&&(this.footprints=params.footprints),params.images!==void 0&&(this.images=params.images),params.segments!==void 0&&(this.segments=params.segments),params.arcs!==void 0&&(this.arcs=params.arcs),params.graphicArcs!==void 0&&(this.graphicArcs=params.graphicArcs),params.graphicCircles!==void 0&&(this.graphicCircles=params.graphicCircles),params.graphicCurves!==void 0&&(this.graphicCurves=params.graphicCurves),params.graphicLines!==void 0&&(this.graphicLines=params.graphicLines),params.graphicTexts!==void 0&&(this.graphicTexts=params.graphicTexts),params.graphicPolys!==void 0&&(this.graphicPolys=params.graphicPolys),params.graphicRects!==void 0&&(this.graphicRects=params.graphicRects),params.vias!==void 0&&(this.vias=params.vias),params.zones!==void 0&&(this.zones=params.zones),params.embeddedFonts!==void 0&&(this.embeddedFonts=params.embeddedFonts),params.embeddedFiles!==void 0&&(this.embeddedFiles=params.embeddedFiles),params.otherChildren!==void 0&&(this.otherChildren=params.otherChildren)}static fromSexprPrimitives(primitiveSexprs){let pcb=new _a414;for(let primitive of primitiveSexprs){if(!Array.isArray(primitive)||primitive.length===0)throw new Error(`kicad_pcb encountered unsupported primitive child: ${JSON.stringify(primitive)}`);let parsed=SxClass.parsePrimitiveSexpr(primitive,{parentToken:_a414.token});if(!(parsed instanceof SxClass))throw new Error(`kicad_pcb expected SxClass child, received ${JSON.stringify(primitive)}`);pcb.consumeChild(parsed)}return pcb}consumeChild(child){if(child instanceof PcbVersion){this._sxVersion=child;return}if(child instanceof PcbGenerator){this._sxGenerator=child;return}if(child instanceof PcbGeneratorVersion){this._sxGeneratorVersion=child;return}if(child instanceof PcbGeneral){this._sxGeneral=child;return}if(child instanceof Paper){this._sxPaper=child;return}if(child instanceof TitleBlock){this._sxTitleBlock=child;return}if(child instanceof PcbLayers){this._sxLayers=child;return}if(child instanceof Setup){this._sxSetup=child;return}if(child instanceof Property){this._properties.push(child);return}if(child instanceof PcbNet){this._nets.push(child);return}if(child instanceof Footprint2){this._footprints.push(child);return}if(child instanceof Image){this._images.push(child);return}if(child instanceof Segment3){this._segments.push(child);return}if(child instanceof PcbArc){this._arcs.push(child);return}if(child instanceof GrArc){this._grArcs.push(child);return}if(child instanceof GrCircle){this._grCircles.push(child);return}if(child instanceof GrCurve){this._grCurves.push(child);return}if(child instanceof GrLine){this._grLines.push(child);return}if(child instanceof GrText){this._grTexts.push(child);return}if(child instanceof GrPoly){this._grPolys.push(child);return}if(child instanceof GrRect){this._grRects.push(child);return}if(child instanceof Via2){this._vias.push(child);return}if(child instanceof Zone){this._zones.push(child);return}if(child instanceof EmbeddedFonts){this._sxEmbeddedFonts=child;return}if(child instanceof EmbeddedFiles){this._sxEmbeddedFiles=child;return}this._otherChildren.push(child)}get version(){return this._sxVersion?.value}set version(value){this._sxVersion=value===void 0?void 0:new PcbVersion(value)}get generator(){return this._sxGenerator?.value}set generator(value){this._sxGenerator=value===void 0?void 0:new PcbGenerator(value)}get generatorVersion(){return this._sxGeneratorVersion?.value}set generatorVersion(value){this._sxGeneratorVersion=value===void 0?void 0:new PcbGeneratorVersion(value)}get general(){return this._sxGeneral}set general(value){this._sxGeneral=value}get paper(){return this._sxPaper}set paper(value){this._sxPaper=value}get titleBlock(){return this._sxTitleBlock}set titleBlock(value){this._sxTitleBlock=value}get layers(){return this._sxLayers}set layers(value){this._sxLayers=value}get setup(){return this._sxSetup}set setup(value){this._sxSetup=value}get properties(){return[...this._properties]}set properties(value){this._properties=[...value]}get nets(){return[...this._nets]}set nets(value){this._nets=[...value]}get footprints(){return[...this._footprints]}set footprints(value){this._footprints=[...value]}get images(){return[...this._images]}set images(value){this._images=[...value]}get segments(){return[...this._segments]}set segments(value){this._segments=[...value]}get arcs(){return[...this._arcs]}set arcs(value){this._arcs=[...value]}get graphicArcs(){return[...this._grArcs]}set graphicArcs(value){this._grArcs=[...value]}get graphicCircles(){return[...this._grCircles]}set graphicCircles(value){this._grCircles=[...value]}get graphicCurves(){return[...this._grCurves]}set graphicCurves(value){this._grCurves=[...value]}get graphicLines(){return[...this._grLines]}set graphicLines(value){this._grLines=[...value]}get graphicTexts(){return[...this._grTexts]}set graphicTexts(value){this._grTexts=[...value]}get graphicPolys(){return[...this._grPolys]}set graphicPolys(value){this._grPolys=[...value]}get graphicRects(){return[...this._grRects]}set graphicRects(value){this._grRects=[...value]}get vias(){return[...this._vias]}set vias(value){this._vias=[...value]}get zones(){return[...this._zones]}set zones(value){this._zones=[...value]}get embeddedFonts(){return this._sxEmbeddedFonts}set embeddedFonts(value){this._sxEmbeddedFonts=value}get embeddedFiles(){return this._sxEmbeddedFiles}set embeddedFiles(value){this._sxEmbeddedFiles=value}get otherChildren(){return[...this._otherChildren]}set otherChildren(value){this._otherChildren=[...value]}getChildren(){let children=[];return this._sxVersion&&children.push(this._sxVersion),this._sxGenerator&&children.push(this._sxGenerator),this._sxGeneratorVersion&&children.push(this._sxGeneratorVersion),this._sxGeneral&&children.push(this._sxGeneral),this._sxPaper&&children.push(this._sxPaper),this._sxTitleBlock&&children.push(this._sxTitleBlock),this._sxLayers&&children.push(this._sxLayers),this._sxSetup&&children.push(this._sxSetup),children.push(...this._properties),children.push(...this._nets),children.push(...this._footprints),children.push(...this._images),children.push(...this._segments),children.push(...this._arcs),children.push(...this._grArcs),children.push(...this._grCircles),children.push(...this._grCurves),children.push(...this._grLines),children.push(...this._grTexts),children.push(...this._grPolys),children.push(...this._grRects),children.push(...this._vias),children.push(...this._zones),this._sxEmbeddedFonts&&children.push(this._sxEmbeddedFonts),this._sxEmbeddedFiles&&children.push(this._sxEmbeddedFiles),children.push(...this._otherChildren),children}},__publicField(_a414,"token","kicad_pcb"),_a414);SxClass.register(KicadPcb);var parseKicadSexpr=sexpr=>SxClass.parse(sexpr),parseKicadSch=sexpr=>{let[root]=parseKicadSexpr(sexpr);if(!(root instanceof KicadSch))throw new Error(`Expected KicadSch root, got ${root?.constructor.name??"undefined"}`);return root},parseKicadPcb=sexpr=>{let[root]=parseKicadSexpr(sexpr);if(!(root instanceof KicadPcb))throw new Error(`Expected KicadPcb root, got ${root?.constructor.name??"undefined"}`);return root};init_src();init_src();init_src();init_src();init_src();init_src();init_src();init_src();init_src();init_src();init_src();init_src();var ConverterStage=class{constructor(ctx){__publicField(this,"ctx");__publicField(this,"MAX_ITERATIONS",100);__publicField(this,"iterationCount",0);__publicField(this,"finished",!1);this.ctx=ctx}runUntilFinished(){for(this.iterationCount=0;!this.finished&&this.iterationCount<this.MAX_ITERATIONS;)this.step()||(this.finished=!0),this.iterationCount++;this.iterationCount>=this.MAX_ITERATIONS&&(this.ctx.warnings=this.ctx.warnings||[],this.ctx.warnings.push(`Stage ${this.constructor.name} exceeded maximum iterations (${this.MAX_ITERATIONS})`),this.finished=!0)}},INNER_COPPER_LAYER_REGEX=/^In([1-6])\.Cu$/;function dedupeLayerRefs(layers){return[...new Set(layers)]}function extractKicadLayerNames(layer){return layer?typeof layer=="string"?[layer]:Array.isArray(layer)?layer.filter(name=>typeof name=="string"):[...layer.names||[],...layer._names||[],...layer._layers||[],...layer.name?[layer.name]:[],...layer._name?[layer._name]:[]].filter(name=>typeof name=="string"):[]}function mapKicadLayerToPcbRenderLayer(layer){let layerNames=extractKicadLayerNames(layer);for(let layerName of layerNames){let copperLayer=mapKicadLayerNameToLayerRef(layerName);if(copperLayer)return`${copperLayer}_copper`;if(layerName.includes("Edge.Cuts"))return"edge_cuts";let side=mapKicadLayerToVisibleLayer(layerName);if(layerName.includes("CrtYd"))return`${side}_courtyard`;if(layerName.includes("Fab"))return`${side}_fabrication_note`;if(layerName.includes("SilkS"))return`${side}_silkscreen`}}function isPcbAnnotationRenderLayer(renderLayer){return renderLayer?.endsWith("_silkscreen")||renderLayer?.endsWith("_fabrication_note")||renderLayer?.endsWith("_courtyard")||!1}function isPcbTextRenderLayer(renderLayer){return renderLayer?.endsWith("_silkscreen")||renderLayer?.endsWith("_fabrication_note")||renderLayer?.endsWith("_copper")||!1}function mapKicadLayerNameToLayerRef(layerName){if(layerName==="F.Cu")return"top";if(layerName==="B.Cu")return"bottom";let innerLayerMatch=layerName.match(INNER_COPPER_LAYER_REGEX);if(innerLayerMatch)return`inner${innerLayerMatch[1]}`}function mapKicadLayerToLayerRef(layer){let layerNames=extractKicadLayerNames(layer);for(let layerName of layerNames){let mappedLayer=mapKicadLayerNameToLayerRef(layerName);if(mappedLayer)return mappedLayer}let layerLabel=layerNames.join(" ");return layerLabel.includes("B.")||layerLabel.includes("Back")||layerLabel.includes("Bottom")?"bottom":"top"}function mapKicadLayerToVisibleLayer(layer){return mapKicadLayerToLayerRef(layer)==="bottom"?"bottom":"top"}function getPcbCopperLayerRefs(kicadPcb){let copperLayers=(Array.isArray(kicadPcb?.layers?._definitions)?(kicadPcb?.layers)._definitions:[]).map(definition=>mapKicadLayerNameToLayerRef(definition?._name)).filter(layer=>!!layer);return copperLayers.length>0?dedupeLayerRefs(copperLayers):["top","bottom"]}function getLayerRefsFromLayers(layers,kicadPcb){let layerNames=extractKicadLayerNames(layers),mappedLayers=[];for(let layerName of layerNames){if(layerName==="*.Cu"){mappedLayers.push(...getPcbCopperLayerRefs(kicadPcb));continue}let mappedLayer=mapKicadLayerNameToLayerRef(layerName);mappedLayer&&mappedLayers.push(mappedLayer)}return dedupeLayerRefs(mappedLayers)}function expandCopperLayerSpan(layers,kicadPcb){if(layers.length<=1)return layers;let copperStack=getPcbCopperLayerRefs(kicadPcb),startIndex=copperStack.indexOf(layers[0]),endIndex=copperStack.indexOf(layers[layers.length-1]);if(startIndex===-1||endIndex===-1)return dedupeLayerRefs(layers);let[fromIndex,toIndex]=startIndex<=endIndex?[startIndex,endIndex]:[endIndex,startIndex];return copperStack.slice(fromIndex,toIndex+1)}function getCopperSpanLayerRefsFromLayers(layers,kicadPcb){return expandCopperLayerSpan(getLayerRefsFromLayers(layers,kicadPcb),kicadPcb)}function getComponentLayer(footprint){return mapKicadLayerToVisibleLayer(footprint.layer)}function determineLayerFromLayers(layers){return mapKicadLayerToLayerRef(extractKicadLayerNames(layers))}function mapTextLayer(kicadLayer){return mapKicadLayerToVisibleLayer(kicadLayer)}function insertFootprintRoute(options){let{ctx,componentId,layer,renderLayer,route,strokeWidth}=options;if(renderLayer.endsWith("_silkscreen")){ctx.db.pcb_silkscreen_path.insert({pcb_component_id:componentId,layer,route,stroke_width:strokeWidth});return}if(renderLayer.endsWith("_fabrication_note")){ctx.db.pcb_fabrication_note_path.insert({pcb_component_id:componentId,layer,route,stroke_width:strokeWidth});return}ctx.db.pcb_courtyard_outline.insert({pcb_component_id:componentId,layer,outline:route})}function rotatePoint5(x4,y4,rotationDeg){let rotationRad=rotationDeg*Math.PI/180;return{x:x4*Math.cos(rotationRad)-y4*Math.sin(rotationRad),y:x4*Math.sin(rotationRad)+y4*Math.cos(rotationRad)}}function processFootprintGraphics(ctx,footprint,componentId,kicadComponentPos,componentRotation){if(!ctx.k2cMatPcb)return;let lines=footprint.fpLines||[],lineArray=Array.isArray(lines)?lines:lines?[lines]:[];for(let line2 of lineArray)createFootprintLine(ctx,line2,componentId,kicadComponentPos,componentRotation);let rects=footprint.fpRects||[],rectArray=Array.isArray(rects)?rects:rects?[rects]:[];for(let rect of rectArray)createFootprintRect(ctx,rect,componentId,kicadComponentPos,componentRotation);let circles=footprint.fpCircles||[],circleArray=Array.isArray(circles)?circles:circles?[circles]:[];for(let circle2 of circleArray)createFootprintCircle(ctx,circle2,componentId,kicadComponentPos,componentRotation);let arcs=footprint.fpArcs||[],arcArray=Array.isArray(arcs)?arcs:arcs?[arcs]:[];for(let arc2 of arcArray)createFootprintArc(ctx,arc2,componentId,kicadComponentPos,componentRotation);let polys=footprint.fpPolys||[],polyArray=Array.isArray(polys)?polys:polys?[polys]:[];for(let poly of polyArray)createFootprintPoly(ctx,poly,componentId,kicadComponentPos,componentRotation)}function createFootprintLine(ctx,line2,componentId,kicadComponentPos,componentRotation){if(!ctx.k2cMatPcb)return;let renderLayer=mapKicadLayerToPcbRenderLayer(line2.layer);if(!isPcbAnnotationRenderLayer(renderLayer))return;let start=line2.start||{x:0,y:0},end=line2.end||{x:0,y:0},rotatedStart=rotatePoint5(start.x,start.y,-componentRotation),rotatedEnd=rotatePoint5(end.x,end.y,-componentRotation),startKicadPos={x:kicadComponentPos.x+rotatedStart.x,y:kicadComponentPos.y+rotatedStart.y},endKicadPos={x:kicadComponentPos.x+rotatedEnd.x,y:kicadComponentPos.y+rotatedEnd.y},startPos=applyToPoint(ctx.k2cMatPcb,startKicadPos),endPos=applyToPoint(ctx.k2cMatPcb,endKicadPos),layer=mapTextLayer(line2.layer),strokeWidth=line2.stroke?.width||line2.width||.12;insertFootprintRoute({ctx,componentId,layer,renderLayer,route:[startPos,endPos],strokeWidth})}function createFootprintRect(ctx,rect,componentId,kicadComponentPos,componentRotation){if(!ctx.k2cMatPcb)return;let renderLayer=mapKicadLayerToPcbRenderLayer(rect.layer);if(!isPcbAnnotationRenderLayer(renderLayer))return;let start=rect.start||{x:0,y:0},end=rect.end||{x:0,y:0},center2={x:(start.x+end.x)/2,y:(start.y+end.y)/2},rotatedCenter=rotatePoint5(center2.x,center2.y,-componentRotation),centerKicadPos={x:kicadComponentPos.x+rotatedCenter.x,y:kicadComponentPos.y+rotatedCenter.y},centerPos=applyToPoint(ctx.k2cMatPcb,centerKicadPos),layer=mapTextLayer(rect.layer),width=Math.abs(end.x-start.x),height=Math.abs(end.y-start.y),strokeWidth=rect.stroke?.width||rect.width||.12;if(renderLayer.endsWith("_courtyard")){ctx.db.pcb_courtyard_rect.insert({pcb_component_id:componentId,center:centerPos,width,height,layer,ccw_rotation:-componentRotation});return}if(renderLayer.endsWith("_fabrication_note")){ctx.db.pcb_fabrication_note_rect.insert({pcb_component_id:componentId,center:centerPos,width,height,layer,stroke_width:strokeWidth,is_filled:rect.fill?.filled===!0,has_stroke:!0});return}let route=[{x:start.x,y:start.y},{x:end.x,y:start.y},{x:end.x,y:end.y},{x:start.x,y:end.y},{x:start.x,y:start.y}].map(point7=>{let rotated=rotatePoint5(point7.x,point7.y,-componentRotation),kicadPos={x:kicadComponentPos.x+rotated.x,y:kicadComponentPos.y+rotated.y};return applyToPoint(ctx.k2cMatPcb,kicadPos)});insertFootprintRoute({ctx,componentId,layer,renderLayer,route,strokeWidth})}function createFootprintCircle(ctx,circle2,componentId,kicadComponentPos,componentRotation){if(!ctx.k2cMatPcb)return;let renderLayer=mapKicadLayerToPcbRenderLayer(circle2.layer);if(!isPcbAnnotationRenderLayer(renderLayer))return;let center2=circle2.center||{x:0,y:0},end=circle2.end||{x:0,y:0},radius=Math.sqrt((end.x-center2.x)**2+(end.y-center2.y)**2),rotatedCenter=rotatePoint5(center2.x,center2.y,-componentRotation),centerKicadPos={x:kicadComponentPos.x+rotatedCenter.x,y:kicadComponentPos.y+rotatedCenter.y},centerPos=applyToPoint(ctx.k2cMatPcb,centerKicadPos),layer=mapTextLayer(circle2.layer),strokeWidth=circle2.stroke?.width||circle2.width||.12;if(renderLayer.endsWith("_courtyard")){ctx.db.pcb_courtyard_circle.insert({pcb_component_id:componentId,center:centerPos,radius,layer});return}let numPoints=16,circleRoute=[];for(let i3=0;i3<=numPoints;i3++){let angle=i3/numPoints*2*Math.PI,x4=centerPos.x+radius*Math.cos(angle),y4=centerPos.y+radius*Math.sin(angle);circleRoute.push({x:x4,y:y4})}insertFootprintRoute({ctx,componentId,layer,renderLayer,route:circleRoute,strokeWidth})}function calculateArcCenter(p12,p22,p32){let ax3=p12.x-p22.x,ay3=p12.y-p22.y,bx3=p22.x-p32.x,by3=p22.y-p32.y,denom=2*(ax3*by3-ay3*bx3);if(Math.abs(denom)<1e-10)return null;let d12=p12.x*p12.x+p12.y*p12.y-p22.x*p22.x-p22.y*p22.y,d22=p22.x*p22.x+p22.y*p22.y-p32.x*p32.x-p32.y*p32.y,cx3=(d12*by3-d22*ay3)/denom,cy3=(ax3*d22-bx3*d12)/denom,radius=Math.sqrt((p12.x-cx3)**2+(p12.y-cy3)**2);return{center:{x:cx3,y:cy3},radius}}function createFootprintArc(ctx,arc2,componentId,kicadComponentPos,componentRotation){if(!ctx.k2cMatPcb)return;let renderLayer=mapKicadLayerToPcbRenderLayer(arc2.layer);if(!isPcbAnnotationRenderLayer(renderLayer))return;let start=arc2.start||{x:0,y:0},mid=arc2.mid||{x:0,y:0},end=arc2.end||{x:0,y:0},rotatedStart=rotatePoint5(start.x,start.y,-componentRotation),rotatedMid=rotatePoint5(mid.x,mid.y,-componentRotation),rotatedEnd=rotatePoint5(end.x,end.y,-componentRotation),startKicadPos={x:kicadComponentPos.x+rotatedStart.x,y:kicadComponentPos.y+rotatedStart.y},midKicadPos={x:kicadComponentPos.x+rotatedMid.x,y:kicadComponentPos.y+rotatedMid.y},endKicadPos={x:kicadComponentPos.x+rotatedEnd.x,y:kicadComponentPos.y+rotatedEnd.y},layer=mapTextLayer(arc2.layer),strokeWidth=arc2.stroke?.width||arc2.width||.12,arcInfo=calculateArcCenter(startKicadPos,midKicadPos,endKicadPos);if(!arcInfo){let startPos=applyToPoint(ctx.k2cMatPcb,startKicadPos),endPos=applyToPoint(ctx.k2cMatPcb,endKicadPos);insertFootprintRoute({ctx,componentId,layer,renderLayer,route:[startPos,endPos],strokeWidth});return}let{center:center2,radius}=arcInfo,startAngle=Math.atan2(startKicadPos.y-center2.y,startKicadPos.x-center2.x),midAngle=Math.atan2(midKicadPos.y-center2.y,midKicadPos.x-center2.x),sweepAngle=Math.atan2(endKicadPos.y-center2.y,endKicadPos.x-center2.x)-startAngle,midSweep=midAngle-startAngle;for(;sweepAngle>Math.PI;)sweepAngle-=2*Math.PI;for(;sweepAngle<-Math.PI;)sweepAngle+=2*Math.PI;for(;midSweep>Math.PI;)midSweep-=2*Math.PI;for(;midSweep<-Math.PI;)midSweep+=2*Math.PI;let isCCW=sweepAngle>0;isCCW&&midSweep>0&&midSweep<sweepAngle||!isCCW&&midSweep<0&&midSweep>sweepAngle||(sweepAngle=sweepAngle>0?sweepAngle-2*Math.PI:sweepAngle+2*Math.PI);let arcLength2=Math.abs(radius*sweepAngle),numSegments=Math.max(2,Math.ceil(arcLength2/.1)),arcRoute=[];for(let i3=0;i3<=numSegments;i3++){let t52=i3/numSegments,angle=startAngle+sweepAngle*t52,kicadPoint={x:center2.x+radius*Math.cos(angle),y:center2.y+radius*Math.sin(angle)},cjPoint=applyToPoint(ctx.k2cMatPcb,kicadPoint);arcRoute.push(cjPoint)}insertFootprintRoute({ctx,componentId,layer,renderLayer,route:arcRoute,strokeWidth})}function createFootprintPoly(ctx,poly,componentId,kicadComponentPos,componentCcwRotationDegrees){if(!ctx.k2cMatPcb)return;let renderLayer=mapKicadLayerToPcbRenderLayer(poly.layer);if(!isPcbAnnotationRenderLayer(renderLayer))return;let ptArray=poly.points?.points||[];if(ptArray.length===0)return;let layer=mapTextLayer(poly.layer),strokeWidth=poly.stroke?.width||poly.width||.12,transformedPts=ptArray.map(p4=>{let x4=p4.x??p4.xy?.x??0,y4=p4.y??p4.xy?.y??0,rotated=rotatePoint5(x4,y4,-componentCcwRotationDegrees),kicadPos={x:kicadComponentPos.x+rotated.x,y:kicadComponentPos.y+rotated.y};return applyToPoint(ctx.k2cMatPcb,kicadPos)});if(renderLayer.endsWith("_courtyard")){ctx.db.pcb_courtyard_outline.insert({pcb_component_id:componentId,layer,outline:transformedPts});return}insertFootprintRoute({ctx,componentId,layer,renderLayer,route:transformedPts,strokeWidth})}function createPcbPort({ctx,componentId,padInfo}){if(!padInfo.layers||padInfo.layers.length===0)return;let sourcePortId=`${componentId}_port_${padInfo.padNumber}`;return ctx.db.pcb_port.insert({pcb_component_id:componentId,source_port_id:sourcePortId,x:padInfo.position.x,y:padInfo.position.y,layers:padInfo.layers}).pcb_port_id}function processPads(ctx,footprint,componentId,kicadComponentPos,componentRotation){if(!ctx.k2cMatPcb)return;let pads=footprint.fpPads||[],padArray=Array.isArray(pads)?pads:[pads];for(let pad2 of padArray)processPad({ctx,pad:pad2,componentId,kicadComponentPos,componentRotation})}function processPad({ctx,pad:pad2,componentId,kicadComponentPos,componentRotation}){if(!ctx.k2cMatPcb)return;let padAt=pad2.at||{x:0,y:0,angle:0},padType=pad2.padType||pad2.type||"thru_hole",padShape=pad2.shape||"circle",rotationRad=-componentRotation*Math.PI/180,rotatedPadX=padAt.x*Math.cos(rotationRad)-padAt.y*Math.sin(rotationRad),rotatedPadY=padAt.x*Math.sin(rotationRad)+padAt.y*Math.cos(rotationRad),padKicadPos={x:kicadComponentPos.x+rotatedPadX,y:kicadComponentPos.y+rotatedPadY},globalPos=applyToPoint(ctx.k2cMatPcb,padKicadPos),sizeX=1,sizeY=1;pad2.size&&(Array.isArray(pad2.size)?(sizeX=pad2.size[0]||1,sizeY=pad2.size[1]||1):typeof pad2.size=="object"&&(sizeX=pad2.size._width||pad2.size.x||1,sizeY=pad2.size._height||pad2.size.y||1));let size3={x:sizeX,y:sizeY},drill=pad2.drill,mappedCopperLayers=padType==="thru_hole"?getCopperSpanLayerRefsFromLayers(pad2.layers||[],ctx.kicadPcb):getLayerRefsFromLayers(pad2.layers||[],ctx.kicadPcb),copperLayers=mappedCopperLayers.length>0?mappedCopperLayers:padType==="thru_hole"?getPcbCopperLayerRefs(ctx.kicadPcb):[],totalCcwRotationDegrees=padAt.angle||0,padNumber=pad2.number?.toString(),pcbPortId,sourcePortId;if(padNumber){let padLayers=padType==="smd"?copperLayers.slice(0,1):padType==="thru_hole"?copperLayers:[];pcbPortId=createPcbPort({ctx,componentId,padInfo:{padNumber,padType,layers:padLayers,position:globalPos}}),pcbPortId&&(sourcePortId=`${componentId}_port_${padNumber}`)}if(padType==="smd"){if(copperLayers.length===0)return;createSmdPad({ctx,pad:pad2,componentId,pos:globalPos,size:size3,shape:padShape,pcbPortId,sourcePortId,padKicadPos,totalCcwRotationDegrees})}else padType==="np_thru_hole"?createNpthHole(ctx,pad2,componentId,globalPos,drill):createPlatedHole(ctx,pad2,componentId,globalPos,size3,drill,padShape,copperLayers,totalCcwRotationDegrees,pcbPortId,sourcePortId)}function createSmdPad({ctx,pad:pad2,componentId,pos,size:size3,shape,pcbPortId,sourcePortId:_sourcePortId,padKicadPos,totalCcwRotationDegrees=0}){let layers=pad2.layers||[],layer=determineLayerFromLayers(layers);if(shape==="custom"){let primitives=pad2._sxPrimitives?._graphics||pad2.primitives||[],primitivesArray=Array.isArray(primitives)?primitives:[primitives],primitivesProcessed=0;for(let primitive of primitivesArray){if(primitive.token==="gr_poly"){let grPoly=primitive.gr_poly||primitive,rawPts=[],ptsContainer=grPoly._sxPts||grPoly.points||grPoly.pts,contours=grPoly._contours||grPoly.contours;if(ptsContainer)Array.isArray(ptsContainer)?rawPts=ptsContainer:Array.isArray(ptsContainer.points)?rawPts=ptsContainer.points:Array.isArray(ptsContainer.pts)&&(rawPts=ptsContainer.pts);else if(Array.isArray(contours))for(let contour of contours){let contourPts=contour.points||contour.pts||[];rawPts.push(...Array.isArray(contourPts)?contourPts:[contourPts])}let points=[];for(let pt3 of rawPts){let x4=pt3.x??pt3.xy?.x,y4=pt3.y??pt3.xy?.y;if(x4!==void 0&&y4!==void 0){let rotated=rotatePoint5(x4,y4,totalCcwRotationDegrees),kicadPos={x:padKicadPos.x+rotated.x,y:padKicadPos.y+rotated.y};points.push(applyToPoint(ctx.k2cMatPcb,kicadPos))}}if(points.length>0){let smtpad2={type:"pcb_smtpad",shape:"polygon",pcb_component_id:componentId,pcb_port_id:pcbPortId,pcb_smtpad_id:"pcb_smtpad_id",layer,port_hints:[pad2.number.toString()],points};ctx.db.pcb_smtpad.insert(smtpad2),primitivesProcessed++}}if(primitive.token==="gr_circle"){let grCircle=primitive.gr_circle||primitive,center2=grCircle.center||grCircle._sxCenter||{x:0,y:0},end=grCircle.end||grCircle._sxEnd||{x:0,y:0},centerlineRadius=Math.sqrt((end.x-center2.x)**2+(end.y-center2.y)**2),strokeWidth=grCircle.stroke?.width||grCircle.width||grCircle._sxWidth?.value||0,radius=(grCircle.fill?.value||grCircle.fill||grCircle._sxFill?.value)==="no"&&strokeWidth>0?centerlineRadius+strokeWidth/2:centerlineRadius,rotatedCenter=rotatePoint5(center2.x,center2.y,totalCcwRotationDegrees),kicadCenterPos={x:padKicadPos.x+rotatedCenter.x,y:padKicadPos.y+rotatedCenter.y},globalCenter=applyToPoint(ctx.k2cMatPcb,kicadCenterPos),smtpad2={type:"pcb_smtpad",shape:"circle",pcb_component_id:componentId,pcb_port_id:pcbPortId,pcb_smtpad_id:"pcb_smtpad_id",layer,port_hints:[pad2.number.toString()],x:globalCenter.x,y:globalCenter.y,width:radius*2,height:radius*2,radius};ctx.db.pcb_smtpad.insert(smtpad2),primitivesProcessed++}}if(primitivesProcessed>0){ctx.stats&&(ctx.stats.pads=(ctx.stats.pads||0)+primitivesProcessed);return}}let ccwRotationDegrees=pad2.at?.angle;if(shape==="circle"){let smtpad2={type:"pcb_smtpad",pcb_component_id:componentId,pcb_smtpad_id:"pcb_smtpad_id",x:pos.x,y:pos.y,width:size3.x,height:size3.y,layer,pcb_port_id:pcbPortId,port_hints:[pad2.number?.toString()],shape:"circle",radius:Math.max(size3.x,size3.y)/2};ctx.db.pcb_smtpad.insert(smtpad2)}else if(shape==="rect"||shape==="roundrect"){let roundrectRatio=pad2._sxRoundrectRatio?.value??pad2.roundrect_rratio,cornerRadius;shape==="roundrect"&&roundrectRatio!==void 0&&(cornerRadius=Math.min(size3.x,size3.y)*roundrectRatio/2);let normalizedCcwRotation=normalizeRotationDegrees(ccwRotationDegrees),rightAngleTurns=getRightAngleTurns(normalizedCcwRotation);if(rightAngleTurns===null&&normalizedCcwRotation!==0){let rotatedsmtpad={type:"pcb_smtpad",pcb_component_id:componentId,x:pos.x,y:pos.y,width:size3.x,height:size3.y,layer,pcb_port_id:pcbPortId,port_hints:[pad2.number.toString()],shape:"rotated_rect",ccw_rotation:normalizedCcwRotation,corner_radius:cornerRadius};ctx.db.pcb_smtpad.insert(rotatedsmtpad);return}let shouldSwapDimensions=rightAngleTurns!==null&&Math.abs(rightAngleTurns)%2===1,smtpad2={type:"pcb_smtpad",pcb_component_id:componentId,x:pos.x,y:pos.y,width:shouldSwapDimensions?size3.y:size3.x,height:shouldSwapDimensions?size3.x:size3.y,layer,pcb_port_id:pcbPortId,port_hints:[pad2.number.toString()],shape:"rect",corner_radius:cornerRadius};ctx.db.pcb_smtpad.insert(smtpad2)}else ctx.db.pcb_smtpad.insert({type:"pcb_smtpad",pcb_component_id:componentId,x:pos.x,y:pos.y,width:size3.x,height:size3.y,layer,pcb_port_id:pcbPortId,port_hints:[pad2.number?.toString()],shape:"rect"});ctx.stats&&(ctx.stats.pads=(ctx.stats.pads||0)+1)}function normalizeRotationDegrees(rotationDegrees){if(!rotationDegrees)return 0;let normalized=rotationDegrees%360;return normalized<0?normalized+360:normalized}function getRightAngleTurns(rotationDegrees){let quarterTurns=rotationDegrees/90;return Math.abs(quarterTurns-Math.round(quarterTurns))>1e-9?null:Math.round(quarterTurns)}function createPlatedHole(ctx,pad2,componentId,pos,size3,drill,shape,layers,_rotation=0,pcbPortId,_sourcePortId=void 0){let drillX=typeof drill=="object"?drill?.x||drill?._width||drill?.diameter||.8:drill||.8,drillY=typeof drill=="object"?drill?.y||drill?._height||drill?.diameter||drillX:drill||.8,holeDiameter=Math.max(drillX,drillY),drillIsOval=typeof drill=="object"&&drillX!==void 0&&drillY!==void 0&&drillX!==drillY,outerWidth=size3.x,outerHeight=size3.y;if(shape==="circle"){let platedHole={type:"pcb_plated_hole",shape:"circle",pcb_component_id:componentId,pcb_port_id:pcbPortId,x:pos.x,y:pos.y,port_hints:[pad2.number?.toString()],hole_diameter:holeDiameter,outer_diameter:Math.max(outerWidth,outerHeight),layers};ctx.db.pcb_plated_hole.insert(platedHole)}else if(shape==="oval"){let platedHole={type:"pcb_plated_hole",shape:"pill",pcb_component_id:componentId,pcb_port_id:pcbPortId,x:pos.x,y:pos.y,port_hints:[pad2.number?.toString()],hole_width:drillY,hole_height:drillX,outer_width:outerWidth,outer_height:outerHeight,ccw_rotation:pad2.at?.angle||0,layers};ctx.db.pcb_plated_hole.insert(platedHole)}else if(shape==="rect"||shape==="square"||shape==="roundrect"){let normalizedCcwRotationDegrees=normalizeRotationDegrees(pad2.at?.angle);if(drillIsOval)if(normalizedCcwRotationDegrees===0){let platedHole={type:"pcb_plated_hole",shape:"pill_hole_with_rect_pad",pcb_component_id:componentId,pcb_port_id:pcbPortId,x:pos.x,y:pos.y,port_hints:[pad2.number?.toString()],hole_shape:"pill",pad_shape:"rect",hole_width:drillY,hole_height:drillX,rect_pad_width:outerWidth,rect_pad_height:outerHeight,hole_offset_x:0,hole_offset_y:0,layers};if(shape==="roundrect"){let roundrectRatio=pad2._sxRoundrectRatio?.value??pad2.roundrect_rratio;if(roundrectRatio!==void 0){let minDimension=Math.min(outerWidth,outerHeight);platedHole.rect_border_radius=minDimension*roundrectRatio/2}}ctx.db.pcb_plated_hole.insert(platedHole)}else{let platedHole={type:"pcb_plated_hole",shape:"rotated_pill_hole_with_rect_pad",pcb_component_id:componentId,pcb_port_id:pcbPortId,x:pos.x,y:pos.y,port_hints:[pad2.number?.toString()],hole_shape:"rotated_pill",pad_shape:"rect",hole_width:drillY,hole_height:drillX,hole_ccw_rotation:normalizedCcwRotationDegrees,rect_ccw_rotation:normalizedCcwRotationDegrees,rect_pad_width:outerWidth,rect_pad_height:outerHeight,hole_offset_x:0,hole_offset_y:0,layers};if(shape==="roundrect"){let roundrectRatio=pad2._sxRoundrectRatio?.value??pad2.roundrect_rratio;if(roundrectRatio!==void 0){let minDimension=Math.min(outerWidth,outerHeight);platedHole.rect_border_radius=minDimension*roundrectRatio/2}}ctx.db.pcb_plated_hole.insert(platedHole)}else{let platedHole={type:"pcb_plated_hole",shape:"circular_hole_with_rect_pad",pcb_component_id:componentId,pcb_port_id:pcbPortId,pcb_plated_hole_id:"pcb_plated_hole_id",x:pos.x,y:pos.y,port_hints:[pad2.number?.toString()],hole_shape:"circle",pad_shape:"rect",hole_diameter:holeDiameter,rect_ccw_rotation:pad2.at?.angle||0,rect_pad_width:outerWidth,rect_pad_height:outerHeight,hole_offset_x:0,hole_offset_y:0,layers};if(shape==="roundrect"){let roundrectRatio=pad2._sxRoundrectRatio?.value??pad2.roundrect_rratio;if(roundrectRatio!==void 0){let minDimension=Math.min(outerWidth,outerHeight);platedHole.rect_border_radius=minDimension*roundrectRatio/2}}ctx.db.pcb_plated_hole.insert(platedHole)}}ctx.stats&&(ctx.stats.pads=(ctx.stats.pads||0)+1)}function createNpthHole(ctx,_pad,componentId,pos,drill){let holeDiameter=drill?.diameter||drill||1,hole={type:"pcb_hole",hole_shape:"circle",pcb_component_id:componentId,x:pos.x,y:pos.y,hole_diameter:holeDiameter};ctx.db.pcb_hole.insert(hole)}function getTextValue(footprint,type){let texts=footprint.fpTexts||[];return(Array.isArray(texts)?texts:[texts]).find(t52=>t52.type===type)?.text}function getPropertyValue(footprint,propertyName){let properties=footprint.properties||[];return(Array.isArray(properties)?properties:[properties]).find(p4=>p4.key===propertyName)?.value}function substituteKicadVariables(text,footprint){let result=text,reference=getPropertyValue(footprint,"Reference")||getTextValue(footprint,"reference")||"?",value=getPropertyValue(footprint,"Value")||getTextValue(footprint,"value")||"";return result=result.replace(/\$\{REFERENCE\}/g,reference),result=result.replace(/\$\{VALUE\}/g,value),result}function mapKicadJustifyToAnchorAlignment(justify){if(!justify)return"center";let horizontal=justify.horizontal||"center",vertical=justify.vertical||"center";if(vertical==="top"){if(horizontal==="left")return"top_left";if(horizontal==="center")return"top_center";if(horizontal==="right")return"top_right"}if(vertical==="center"){if(horizontal==="left")return"center_left";if(horizontal==="center")return"center";if(horizontal==="right")return"center_right"}if(vertical==="bottom"){if(horizontal==="left")return"bottom_left";if(horizontal==="center")return"bottom_center";if(horizontal==="right")return"bottom_right"}return"center"}function processFootprintText(ctx,footprint,componentId,kicadComponentPos,componentRotation){if(!ctx.k2cMatPcb)return;processFootprintProperties(ctx,footprint,componentId,kicadComponentPos,componentRotation);let texts=footprint.fpTexts||[],textArray=Array.isArray(texts)?texts:[texts];for(let text of textArray){let renderLayer=mapKicadLayerToPcbRenderLayer(text.layer);if(!isPcbTextRenderLayer(renderLayer))continue;let textElement={text:text.text,at:text._sxPosition||text.at,layer:text.layer,effects:text._sxEffects||text.effects,_sxEffects:text._sxEffects};createGraphicText(ctx,textElement,renderLayer,componentId,kicadComponentPos,componentRotation,footprint)}}function processFootprintProperties(ctx,footprint,componentId,kicadComponentPos,componentRotation){if(!ctx.k2cMatPcb)return;let properties=footprint.properties||[],propertyArray=Array.isArray(properties)?properties:[properties];for(let property of propertyArray){if(!property.layer)continue;let renderLayer=mapKicadLayerToPcbRenderLayer(property.layer),isPropertyHidden=property.hidden;if(!isPcbTextRenderLayer(renderLayer)||isPropertyHidden)continue;let textElement={text:property.value,at:property._sxAt,layer:property.layer,effects:property._sxEffects||property.effects,_sxEffects:property._sxEffects};createGraphicText(ctx,textElement,renderLayer,componentId,kicadComponentPos,componentRotation,footprint)}}function createGraphicText(ctx,text,renderLayer,componentId,kicadComponentPos,componentRotation,footprint){if(!ctx.k2cMatPcb)return;let at3=text.at,textLocalX=at3?.x??0,textLocalY=at3?.y??0,rotationRad=-componentRotation*Math.PI/180,rotatedTextX=textLocalX*Math.cos(rotationRad)-textLocalY*Math.sin(rotationRad),rotatedTextY=textLocalX*Math.sin(rotationRad)+textLocalY*Math.cos(rotationRad),textKicadPos={x:kicadComponentPos.x+rotatedTextX,y:kicadComponentPos.y+rotatedTextY},pos=applyToPoint(ctx.k2cMatPcb,textKicadPos),layer=mapTextLayer(text.layer),processedText=substituteKicadVariables(text.text||"",footprint),kicadFontSize=text._sxEffects?._sxFont?._sxSize?._height||text.effects?.font?.size?.y||1,justify=text._sxEffects?._sxJustify||text.effects?.justify,anchorAlignment=mapKicadJustifyToAnchorAlignment(justify);if(renderLayer.endsWith("_silkscreen")){ctx.db.pcb_silkscreen_text.insert({pcb_component_id:componentId,font:"tscircuit2024",font_size:kicadFontSize*1.5,text:processedText,anchor_position:pos,anchor_alignment:anchorAlignment,layer});return}if(renderLayer.endsWith("_fabrication_note")){ctx.db.pcb_fabrication_note_text.insert({pcb_component_id:componentId,font:"tscircuit2024",font_size:kicadFontSize*1.5,text:processedText,anchor_position:pos,anchor_alignment:anchorAlignment,layer});return}renderLayer.endsWith("_copper")&&ctx.db.pcb_copper_text.insert({pcb_component_id:componentId,font:"tscircuit2024",font_size:kicadFontSize*1.5,text:processedText,anchor_position:pos,anchor_alignment:anchorAlignment,layer})}function inferComponentType(reference){if(!reference)return"simple_chip";switch(reference.match(/^([A-Z]+)/)?.[1]){case"R":return"simple_resistor";case"C":return"simple_capacitor";case"L":return"simple_inductor";case"D":return"simple_diode";case"LED":return"simple_diode";case"Q":return"simple_transistor";case"U":case"IC":return"simple_chip";case"J":case"P":return"simple_chip";default:return"simple_chip"}}function inferTransistorTypeFromFootprint(footprint,value){let lowerValue=(value||"").toLowerCase();if(lowerValue.includes("pnp"))return"pnp";if(lowerValue.includes("npn"))return"npn";let lowerLibId=(footprint.libraryId||"").toLowerCase();return lowerLibId.includes("pnp")?"pnp":(lowerLibId.includes("npn"),"npn")}function getFootprintProperties(footprint){let properties=footprint.properties||[];return Array.isArray(properties)?properties:[properties]}function getFootprintPropertyName(property){return property?.key}function getFootprintPropertyValue(property){return property?.value}function findFootprintProperty(footprint,propertyNames){let names=Array.isArray(propertyNames)?propertyNames:[propertyNames];return getFootprintProperties(footprint).find(property=>names.includes(getFootprintPropertyName(property)??""))}function findFootprintPropertyValue(footprint,propertyNames){let property=findFootprintProperty(footprint,propertyNames);return getFootprintPropertyValue(property)}function parseSupplierPartNumbers(value){if(!value)return;let partNumbers=value.split(/[,;]/).map(partNumber=>partNumber.trim()).filter(Boolean);return partNumbers.length>0?partNumbers:void 0}function processFootprint(ctx,footprint){if(!ctx.k2cMatPcb)return;let position4=footprint.position,kicadPos={x:position4?.x??0,y:position4?.y??0},cjPos=applyToPoint(ctx.k2cMatPcb,kicadPos),rotation5=position4?.angle??0,uuid=footprint.uuid?.value||footprint.tstamp?.value;if(!uuid)return;let refdes=getFootprintReference(footprint),value=getFootprintValue(footprint),jlcpcbPartNumbers=getJlcpcbPartNumbers(footprint),ftype=inferComponentType(refdes),sourceComponentData={name:refdes||"U",ftype};if(ftype==="simple_transistor"&&(sourceComponentData.transistor_type=inferTransistorTypeFromFootprint(footprint,value)),jlcpcbPartNumbers&&(sourceComponentData.supplier_part_numbers={jlcpcb:jlcpcbPartNumbers}),value){let sanitizedValue=value.replace(/,/g,".");switch(ftype){case"simple_resistor":sourceComponentData.resistance=sanitizedValue;break;case"simple_capacitor":sourceComponentData.capacitance=sanitizedValue;break;case"simple_inductor":sourceComponentData.inductance=sanitizedValue;break}}let sourceComponentId=ctx.db.source_component.insert(sourceComponentData).source_component_id,componentId=ctx.db.pcb_component.insert({center:{x:cjPos.x,y:cjPos.y},layer:getComponentLayer(footprint),rotation:-rotation5,width:0,height:0,source_component_id:sourceComponentId}).pcb_component_id;ctx.footprintUuidToComponentId?.set(uuid,componentId),ctx.footprintUuidToSourceComponentId?.set(uuid,sourceComponentId),processPads(ctx,footprint,componentId,kicadPos,rotation5),processFootprintText(ctx,footprint,componentId,kicadPos,rotation5),processFootprintGraphics(ctx,footprint,componentId,kicadPos,rotation5),ctx.stats&&(ctx.stats.components=(ctx.stats.components||0)+1)}function getFootprintReference(footprint){let propertyValue=findFootprintPropertyValue(footprint,"Reference");if(propertyValue)return propertyValue;let textItems=footprint.fpTexts||[],textArray=Array.isArray(textItems)?textItems:[textItems];for(let text of textArray)if(text.type==="reference")return text.text}function getFootprintValue(footprint){let propertyValue=findFootprintPropertyValue(footprint,"Value");if(propertyValue)return propertyValue;let textItems=footprint.fpTexts||[],textArray=Array.isArray(textItems)?textItems:[textItems];for(let text of textArray)if(text.type==="value")return text.text}function getJlcpcbPartNumbers(footprint){return parseSupplierPartNumbers(findFootprintPropertyValue(footprint,["JLCPCB Part #","Supplier Part Number"]))}var CollectFootprintsStage=class extends ConverterStage{constructor(){super(...arguments);__publicField(this,"processedFootprints",new Set)}step(){if(!this.ctx.kicadPcb||!this.ctx.k2cMatPcb)return this.finished=!0,!1;let footprints=this.ctx.kicadPcb.footprints||[],footprintArray=Array.isArray(footprints)?footprints:[footprints];for(let footprint of footprintArray){let uuid=footprint.uuid?.value||footprint.tstamp?.value;uuid&&(this.processedFootprints.has(uuid)||(processFootprint(this.ctx,footprint),this.processedFootprints.add(uuid)))}return this.finished=!0,!1}},FULL_TURN=Math.PI*2;function normalizeToArray(value){return value?Array.isArray(value)?value:[value]:[]}function getLayerNames(layer){return layer?typeof layer=="string"?[layer]:layer.names||[]:[]}function getGraphicLayerNames(graphic){return getLayerNames(graphic?.layer)}function getPcbPoint(point7){return{x:point7?.x??0,y:point7?.y??0}}function getLineStartEnd(line2){return{start:getPcbPoint(line2.start),end:getPcbPoint(line2.end)}}function getArcStartMidEnd(arc2){return{start:getPcbPoint(arc2.start),mid:getPcbPoint(arc2.mid),end:getPcbPoint(arc2.end)}}function getCircleCenterEnd(circle2){return{center:getPcbPoint(circle2.center),end:getPcbPoint(circle2.end)}}function getGraphicArcs(kicadPcb){return normalizeToArray(kicadPcb.graphicArcs)}function getGraphicCircles(kicadPcb){return normalizeToArray(kicadPcb.graphicCircles)}function getGraphicCurves(kicadPcb){return normalizeToArray(kicadPcb.graphicCurves)}function getTopLevelCopperArcs(kicadPcb){return normalizeToArray(kicadPcb.arcs)}function approximateArcPoints(start,mid,end,options){let geometry=getArcGeometry(start,mid,end);if(!geometry)return[start,end];let segmentLength=options?.segmentLength??.25,minSegments=options?.minSegments??8,arcLength2=Math.abs(geometry.radius*geometry.sweepAngle),numSegments=Math.max(2,minSegments,Math.ceil(arcLength2/segmentLength)),points=[];for(let i3=0;i3<=numSegments;i3++){let t52=i3/numSegments,angle=geometry.startAngle+geometry.sweepAngle*t52;points.push({x:geometry.center.x+geometry.radius*Math.cos(angle),y:geometry.center.y+geometry.radius*Math.sin(angle)})}return points}function getCurvePoints(curve){let xyPoints=(curve.points?.points??[]).filter(point7=>point7.token==="xy").map(point7=>getPcbPoint(point7));return xyPoints.length<4?null:{start:xyPoints[0],control1:xyPoints[1],control2:xyPoints[2],end:xyPoints[3]}}function approximateCubicBezierPoints(start,control1,control2,end,options){let segmentLength=options?.segmentLength??.25,minSegments=options?.minSegments??8,controlPolygonLength=getDistance4(start,control1)+getDistance4(control1,control2)+getDistance4(control2,end),numSegments=Math.max(2,minSegments,Math.ceil(controlPolygonLength/segmentLength)),points=[];for(let i3=0;i3<=numSegments;i3++){let t52=i3/numSegments,omt=1-t52;points.push({x:omt**3*start.x+3*omt**2*t52*control1.x+3*omt*t52**2*control2.x+t52**3*end.x,y:omt**3*start.y+3*omt**2*t52*control1.y+3*omt*t52**2*control2.y+t52**3*end.y})}return points}function approximateCirclePoints(center2,end,options){let radius=getDistance4(center2,end);if(radius<=0)return[center2];let segmentLength=options?.segmentLength??.25,minSegments=options?.minSegments??16,circumference=FULL_TURN*radius,numSegments=Math.max(8,minSegments,Math.ceil(circumference/segmentLength)),startAngle=Math.atan2(end.y-center2.y,end.x-center2.x),points=[];for(let i3=0;i3<=numSegments;i3++){let t52=i3/numSegments,angle=startAngle+FULL_TURN*t52;points.push({x:center2.x+radius*Math.cos(angle),y:center2.y+radius*Math.sin(angle)})}return points}function getArcGeometry(start,mid,end){let circle2=calculateArcCenter2(start,mid,end);if(!circle2)return null;let startAngle=Math.atan2(start.y-circle2.center.y,start.x-circle2.center.x),midAngle=Math.atan2(mid.y-circle2.center.y,mid.x-circle2.center.x),endAngle=Math.atan2(end.y-circle2.center.y,end.x-circle2.center.x),sweepAngle=normalizeSignedAngle(endAngle-startAngle),midSweep=normalizeSignedAngle(midAngle-startAngle),isCounterClockwise=sweepAngle>0;return isCounterClockwise&&midSweep>0&&midSweep<sweepAngle||!isCounterClockwise&&midSweep<0&&midSweep>sweepAngle||(sweepAngle=sweepAngle>0?sweepAngle-FULL_TURN:sweepAngle+FULL_TURN),{center:circle2.center,radius:circle2.radius,startAngle,sweepAngle}}function normalizeSignedAngle(angle){for(;angle<=-Math.PI;)angle+=FULL_TURN;for(;angle>Math.PI;)angle-=FULL_TURN;return angle}function calculateArcCenter2(p12,p22,p32){let ax3=p12.x,ay3=p12.y,bx3=p22.x,by3=p22.y,cx3=p32.x,cy3=p32.y,determinant=2*(ax3*(by3-cy3)+bx3*(cy3-ay3)+cx3*(ay3-by3));if(Math.abs(determinant)<1e-10)return null;let ux3=((ax3*ax3+ay3*ay3)*(by3-cy3)+(bx3*bx3+by3*by3)*(cy3-ay3)+(cx3*cx3+cy3*cy3)*(ay3-by3))/determinant,uy3=((ax3*ax3+ay3*ay3)*(cx3-bx3)+(bx3*bx3+by3*by3)*(ax3-cx3)+(cx3*cx3+cy3*cy3)*(bx3-ax3))/determinant;return{center:{x:ux3,y:uy3},radius:Math.sqrt((ax3-ux3)**2+(ay3-uy3)**2)}}function getDistance4(a3,b3){return Math.hypot(b3.x-a3.x,b3.y-a3.y)}var CollectGraphicsStage=class extends ConverterStage{step(){if(!this.ctx.kicadPcb||!this.ctx.k2cMatPcb)return this.finished=!0,!1;let lines=this.ctx.kicadPcb.graphicLines||[],lineArray=Array.isArray(lines)?lines:[lines],arcArray=getGraphicArcs(this.ctx.kicadPcb),circleArray=getGraphicCircles(this.ctx.kicadPcb),curveArray=getGraphicCurves(this.ctx.kicadPcb),edgeCutPrimitives=[];for(let line2 of lineArray){let layerStr=getGraphicLayerNames(line2).join(" ");if(layerStr.includes("Edge.Cuts")){let{start,end}=getLineStartEnd(line2);edgeCutPrimitives.push({type:"line",start,end})}else if(layerStr.includes("SilkS")||layerStr.includes("Fab")||layerStr.includes("CrtYd")){let renderLayer=mapKicadLayerToPcbRenderLayer(line2.layer);renderLayer&&this.createGraphicPath(line2,renderLayer)}}for(let arc2 of arcArray){let layerStr=getGraphicLayerNames(arc2).join(" ");if(layerStr.includes("Edge.Cuts")){let{start,mid,end}=getArcStartMidEnd(arc2);edgeCutPrimitives.push({type:"arc",start,mid,end})}else if(layerStr.includes("SilkS")||layerStr.includes("Fab")||layerStr.includes("CrtYd")){let renderLayer=mapKicadLayerToPcbRenderLayer(arc2.layer);renderLayer&&this.createGraphicArc(arc2,renderLayer)}}for(let circle2 of circleArray){if(!getGraphicLayerNames(circle2).join(" ").includes("Edge.Cuts"))continue;let{center:center2,end}=getCircleCenterEnd(circle2);edgeCutPrimitives.push({type:"circle",center:center2,start:end,end})}for(let curve of curveArray){if(!getGraphicLayerNames(curve).join(" ").includes("Edge.Cuts"))continue;let points=getCurvePoints(curve);points&&edgeCutPrimitives.push({type:"curve",start:points.start,control1:points.control1,control2:points.control2,end:points.end})}edgeCutPrimitives.length>0&&this.createBoardOutline(edgeCutPrimitives);let grRects=this.ctx.kicadPcb.graphicRects||[];for(let rect of grRects)this.processRectangle(rect);let grPolys=this.ctx.kicadPcb.graphicPolys||[],polyArray=Array.isArray(grPolys)?grPolys:[grPolys];for(let poly of polyArray)this.processPolygon(poly);let texts=this.ctx.kicadPcb.graphicTexts||[],textArray=Array.isArray(texts)?texts:[texts];for(let text of textArray){let renderLayer=mapKicadLayerToPcbRenderLayer(text.layer);renderLayer&&this.createGraphicText(text,renderLayer)}return this.finished=!0,!1}createBoardOutline(primitives){if(!this.ctx.k2cMatPcb)return;let orderedSegments=[],remainingSegments=[...primitives];if(remainingSegments.length>0)for(orderedSegments.push(remainingSegments.shift());remainingSegments.length>0;){let lastEnd=orderedSegments[orderedSegments.length-1].end,foundIndex=remainingSegments.findIndex(seg=>this.pointsEqualKicad(seg.start,lastEnd));if(foundIndex===-1&&(foundIndex=remainingSegments.findIndex(seg=>this.pointsEqualKicad(seg.end,lastEnd)),foundIndex!==-1)){let seg=remainingSegments[foundIndex];orderedSegments.push(seg.type==="arc"?{type:"arc",start:seg.end,mid:seg.mid,end:seg.start}:seg.type==="circle"?{type:"circle",center:seg.center,start:seg.end,end:seg.start}:seg.type==="curve"?{type:"curve",start:seg.end,control1:seg.control2,control2:seg.control1,end:seg.start}:{type:"line",start:seg.end,end:seg.start}),remainingSegments.splice(foundIndex,1);continue}foundIndex!==-1?orderedSegments.push(remainingSegments.splice(foundIndex,1)[0]):orderedSegments.push(remainingSegments.shift())}let points=[];for(let segment2 of orderedSegments){let kicadPoints;segment2.type==="arc"?kicadPoints=approximateArcPoints(segment2.start,segment2.mid,segment2.end,{segmentLength:.25,minSegments:16}):segment2.type==="circle"?kicadPoints=approximateCirclePoints(segment2.center,segment2.end,{segmentLength:.25,minSegments:16}):segment2.type==="curve"?kicadPoints=approximateCubicBezierPoints(segment2.start,segment2.control1,segment2.control2,segment2.end,{segmentLength:.25,minSegments:16}):kicadPoints=[segment2.start,segment2.end];for(let kicadPoint of kicadPoints){let point7=applyToPoint(this.ctx.k2cMatPcb,kicadPoint),lastPoint=points[points.length-1];(!lastPoint||!this.pointsEqual(lastPoint,point7))&&points.push(point7)}}let existingBoard=this.ctx.db.pcb_board.list()[0];existingBoard?(existingBoard.outline=points,existingBoard.width=this.calculateWidth(points),existingBoard.height=this.calculateHeight(points)):this.ctx.db.pcb_board.insert({outline:points,width:this.calculateWidth(points),height:this.calculateHeight(points)})}createGraphicPath(line2,renderLayer){if(!this.ctx.k2cMatPcb)return;let{start,end}=getLineStartEnd(line2),startPos=applyToPoint(this.ctx.k2cMatPcb,start),endPos=applyToPoint(this.ctx.k2cMatPcb,end),layer=mapKicadLayerToVisibleLayer(line2.layer),strokeWidth=line2.width||.15;this.insertRouteGraphic({layer,renderLayer,pcbComponentId:"",route:[startPos,endPos],strokeWidth})}createGraphicArc(arc2,renderLayer){if(!this.ctx.k2cMatPcb)return;let{start,mid,end}=getArcStartMidEnd(arc2),route=approximateArcPoints(start,mid,end,{segmentLength:.1,minSegments:8}).map(point7=>applyToPoint(this.ctx.k2cMatPcb,point7)),layer=mapKicadLayerToVisibleLayer(arc2.layer),strokeWidth=arc2.stroke?.width??arc2._sxStroke?._sxWidth?.value??arc2.width??.15;this.insertRouteGraphic({layer,renderLayer,pcbComponentId:"",route,strokeWidth})}insertRouteGraphic(options){let{layer,renderLayer,pcbComponentId,route,strokeWidth}=options;if(renderLayer.endsWith("_silkscreen")){this.ctx.db.pcb_silkscreen_path.insert({pcb_component_id:pcbComponentId,layer,route,stroke_width:strokeWidth});return}if(renderLayer.endsWith("_fabrication_note")){this.ctx.db.pcb_fabrication_note_path.insert({pcb_component_id:pcbComponentId,layer,route,stroke_width:strokeWidth});return}this.ctx.db.pcb_courtyard_outline.insert({pcb_component_id:pcbComponentId,layer,outline:route})}processRectangle(rect){if(!this.ctx.k2cMatPcb)return;let start={x:rect._sxStart?._x??0,y:rect._sxStart?._y??0},end={x:rect._sxEnd?._x??0,y:rect._sxEnd?._y??0},renderLayer=mapKicadLayerToPcbRenderLayer(rect._sxLayer),isFilled=rect._sxFill&&(rect._sxFill.isFilled===!0||String(rect._sxFill).includes("fill yes")),isCopperLayer=renderLayer?.endsWith("_copper"),centerKicad={x:(start.x+end.x)/2,y:(start.y+end.y)/2},widthKicad=Math.abs(end.x-start.x),heightKicad=Math.abs(end.y-start.y),centerCJ=applyToPoint(this.ctx.k2cMatPcb,centerKicad);if(isFilled&&isCopperLayer){let layer2=mapKicadLayerToLayerRef(rect._sxLayer);this.ctx.db.pcb_smtpad.insert({pcb_component_id:"",x:centerCJ.x,y:centerCJ.y,width:widthKicad,height:heightKicad,layer:layer2,shape:"rect",port_hints:[]}),this.ctx.stats&&(this.ctx.stats.pads=(this.ctx.stats.pads||0)+1);return}let layer=mapKicadLayerToVisibleLayer(rect._sxLayer),strokeWidth=rect.stroke?.width??rect._sxStroke?._sxWidth?.value??rect.width??.15;if(renderLayer?.endsWith("_fabrication_note")){this.ctx.db.pcb_fabrication_note_rect.insert({pcb_component_id:"",center:centerCJ,width:widthKicad,height:heightKicad,layer,stroke_width:strokeWidth,is_filled:isFilled,has_stroke:!0});return}renderLayer?.endsWith("_courtyard")&&this.ctx.db.pcb_courtyard_rect.insert({pcb_component_id:"",center:centerCJ,width:widthKicad,height:heightKicad,layer})}createGraphicText(text,renderLayer){if(!this.ctx.k2cMatPcb)return;let at3=text.at||text._sxPosition,pos=applyToPoint(this.ctx.k2cMatPcb,{x:at3?.x??0,y:at3?.y??0}),layer=mapKicadLayerToVisibleLayer(text.layer),fontSize=(text._sxEffects?._sxFont?._sxSize?._height||text.effects?.font?.size?.y||1)*1.5,textValue=text.text||text._text||"",justify=text._sxEffects?._sxJustify||text.effects?.justify,anchorAlignment=mapKicadJustifyToAnchorAlignment(justify);if(renderLayer.endsWith("_silkscreen")){this.ctx.db.pcb_silkscreen_text.insert({pcb_component_id:"",text:textValue,anchor_position:pos,anchor_alignment:anchorAlignment,layer,font_size:fontSize,font:"tscircuit2024"});return}if(renderLayer.endsWith("_fabrication_note")){this.ctx.db.pcb_fabrication_note_text.insert({pcb_component_id:"",text:textValue,anchor_position:pos,anchor_alignment:anchorAlignment,layer,font_size:fontSize,font:"tscircuit2024"});return}renderLayer.endsWith("_copper")&&this.ctx.db.pcb_copper_text.insert({pcb_component_id:"",text:textValue,anchor_position:pos,anchor_alignment:anchorAlignment,layer,font_size:fontSize,font:"tscircuit2024"})}pointsEqual(p12,p22){return Math.abs(p12.x-p22.x)<.001&&Math.abs(p12.y-p22.y)<.001}pointsEqualKicad(p12,p22){return Math.abs(p12.x-p22.x)<.001&&Math.abs(p12.y-p22.y)<.001}calculateWidth(points){if(points.length===0)return 0;let xs3=points.map(p4=>p4.x);return Math.max(...xs3)-Math.min(...xs3)}calculateHeight(points){if(points.length===0)return 0;let ys3=points.map(p4=>p4.y);return Math.max(...ys3)-Math.min(...ys3)}processPolygon(poly){if(!this.ctx.k2cMatPcb)return;let renderLayer=mapKicadLayerToPcbRenderLayer(poly._sxLayer),isFilled=poly._sxFill?.filled===!0,isCopperLayer=renderLayer?.endsWith("_copper");if(!isFilled&&!renderLayer?.endsWith("_courtyard"))return;let ptsData=poly._sxPts?.points||[],points=[];for(let pt3 of ptsData)if(pt3.token==="xy")points.push({x:pt3.x,y:pt3.y});else if(pt3.token==="arc"){let arcPoints=approximateArcPoints({x:pt3._sxStart?._x,y:pt3._sxStart?._y},{x:pt3._sxMid?._x,y:pt3._sxMid?._y},{x:pt3._sxEnd?._x,y:pt3._sxEnd?._y});points.push(...arcPoints)}if(points.length<3)return;let transformedPoints=points.map(pt3=>applyToPoint(this.ctx.k2cMatPcb,pt3));if(isFilled&&isCopperLayer){let layer=mapKicadLayerToLayerRef(poly._sxLayer);this.ctx.db.pcb_smtpad.insert({pcb_component_id:"",shape:"polygon",points:transformedPoints,layer,port_hints:[]}),this.ctx.stats&&(this.ctx.stats.pads=(this.ctx.stats.pads||0)+1);return}if(renderLayer?.endsWith("_courtyard")){let layer=mapKicadLayerToVisibleLayer(poly._sxLayer);this.ctx.db.pcb_courtyard_outline.insert({pcb_component_id:"",layer,outline:transformedPoints})}}},CollectNetsStage=class extends ConverterStage{step(){if(!this.ctx.kicadPcb||!this.ctx.netNumToName)return this.finished=!0,!1;let nets=this.ctx.kicadPcb.nets||[],netArray=Array.isArray(nets)?nets:[nets];for(let net of netArray){let netNum=net._id??net.number??net.ordinal??0,netName=net._name??net.name??`Net-${netNum}`;this.ctx.netNumToName.set(netNum,netName)}return this.ctx.netNumToName.has(0)||this.ctx.netNumToName.set(0,""),this.finished=!0,!1}},CollectSourceTracesStage=class extends ConverterStage{constructor(){super(...arguments);__publicField(this,"processedNets",new Set)}step(){if(!this.ctx.kicadPcb||!this.ctx.netNumToName)return this.finished=!0,!1;let netToPads=new Map,footprints=this.ctx.kicadPcb.footprints||[],footprintArray=Array.isArray(footprints)?footprints:[footprints];for(let footprint of footprintArray)this.processFootprintPads(footprint,netToPads);this.collectNetsFromCopper(netToPads);for(let[netNum,pads]of netToPads.entries())this.processedNets.has(netNum)||(this.createSourceTrace(netNum,pads),this.processedNets.add(netNum));return this.finished=!0,!1}collectNetsFromCopper(netToPads){if(!this.ctx.kicadPcb)return;let segments=this.ctx.kicadPcb.segments||[],segmentArray=Array.isArray(segments)?segments:[segments];for(let segment2 of segmentArray){let netNum=this.getSegmentNet(segment2);netNum&&(netToPads.has(netNum)||netToPads.set(netNum,[]))}let arcArray=getTopLevelCopperArcs(this.ctx.kicadPcb);for(let arc2 of arcArray){let netNum=this.getSegmentNet(arc2);netNum&&(netToPads.has(netNum)||netToPads.set(netNum,[]))}}getSegmentNet(segment2){let net=segment2?.net;return net?typeof net=="number"?net:typeof net=="object"?net._id??net.number??net.ordinal??null:null:null}processFootprintPads(footprint,netToPads){let footprintUuid=footprint.uuid?.value||footprint.tstamp?.value;if(!footprintUuid)return;let componentId=this.ctx.footprintUuidToComponentId?.get(footprintUuid);if(!componentId)return;let pads=footprint.fpPads||[],padArray=Array.isArray(pads)?pads:[pads];for(let pad2 of padArray){let padNumber=pad2.number?.toString();if(!padNumber)continue;let netNum=this.getPadNet(pad2);if(netNum==null||netNum===0)continue;let sourcePortId=this.getOrCreateSourcePort(componentId,padNumber,footprint);netToPads.has(netNum)||netToPads.set(netNum,[]),netToPads.get(netNum).push({componentId,padNumber,sourcePortId})}}getPadNet(pad2){let net=pad2._sxNet||pad2.net;return net?typeof net=="number"?net:typeof net=="object"?net._id??net.number??net.ordinal??null:null:null}getOrCreateSourcePort(componentId,padNumber,footprint){let sourcePortId=`${componentId}_port_${padNumber}`;if(!this.ctx.db.source_port.list().find(sp3=>sp3.source_port_id===sourcePortId)){let footprintUuid=footprint.uuid?.value||footprint.tstamp?.value,sourceComponentId=footprintUuid&&this.ctx.footprintUuidToSourceComponentId?this.ctx.footprintUuidToSourceComponentId.get(footprintUuid):void 0,reference=this.getFootprintReference(footprint);this.ctx.db.source_port.insert({source_port_id:sourcePortId,source_component_id:sourceComponentId||componentId,name:`${reference||"U"}.${padNumber}`,pin_number:parseInt(padNumber,10)||void 0})}return sourcePortId}getFootprintReference(footprint){let propertyValue=findFootprintPropertyValue(footprint,"Reference");if(propertyValue)return propertyValue;let textItems=footprint.fpTexts||[],textArray=Array.isArray(textItems)?textItems:[textItems];for(let text of textArray)if(text.type==="reference")return text.text}createSourceTrace(netNum,pads){let netName=this.ctx.netNumToName?.get(netNum)||`Net-${netNum}`,sourceTrace=this.ctx.db.source_trace.insert({connected_source_port_ids:pads.map(p4=>p4.sourcePortId),connected_source_net_ids:[],display_name:netName});this.ctx.netNumToSourceTraceId?.set(netNum,sourceTrace.source_trace_id),this.ctx.stats&&(this.ctx.stats.traces=(this.ctx.stats.traces||0)+1)}},CollectTracesStage=class extends ConverterStage{constructor(){super(...arguments);__publicField(this,"PORT_MATCH_TOLERANCE",.001)}step(){if(!this.ctx.kicadPcb||!this.ctx.k2cMatPcb||!this.ctx.netNumToName||!this.ctx.netNumToSourceTraceId)return this.finished=!0,!1;let segments=this.ctx.kicadPcb.segments||[],segmentArray=Array.isArray(segments)?segments:[segments],arcArray=getTopLevelCopperArcs(this.ctx.kicadPcb);for(let segment2 of segmentArray)this.createTraceFromSegment(segment2);for(let arc2 of arcArray)this.createTraceFromArc(arc2);return this.finished=!0,!1}createTraceFromSegment(segment2){if(!this.ctx.k2cMatPcb||!this.ctx.netNumToSourceTraceId)return;let start=segment2.start||{x:0,y:0},end=segment2.end||{x:0,y:0},width=segment2.width||.2,layer=segment2.layer,layerStr=getLayerNames(layer).join(" "),mappedLayer=mapKicadLayerToLayerRef(layerStr),netNum=this.getSegmentNet(segment2),sourceTraceId=netNum!==null?this.ctx.netNumToSourceTraceId.get(netNum)??void 0:void 0,startPos=applyToPoint(this.ctx.k2cMatPcb,{x:start.x,y:start.y}),endPos=applyToPoint(this.ctx.k2cMatPcb,{x:end.x,y:end.y}),startPcbPortId=this.findPortAtPosition(startPos,mappedLayer),endPcbPortId=this.findPortAtPosition(endPos,mappedLayer),route=[{route_type:"wire",x:startPos.x,y:startPos.y,width,layer:mappedLayer,start_pcb_port_id:startPcbPortId},{route_type:"wire",x:endPos.x,y:endPos.y,width,layer:mappedLayer,end_pcb_port_id:endPcbPortId}];this.ctx.db.pcb_trace.insert({route,source_trace_id:sourceTraceId,pcb_port_id:void 0}),this.ctx.stats&&(this.ctx.stats.traces=(this.ctx.stats.traces||0)+1)}createTraceFromArc(arc2){if(!this.ctx.k2cMatPcb||!this.ctx.netNumToSourceTraceId)return;let{start,mid,end}=getArcStartMidEnd(arc2),width=arc2.width??arc2._sxWidth?.value??.2,layerStr=getLayerNames(arc2.layer).join(" "),mappedLayer=mapKicadLayerToLayerRef(layerStr),netNum=this.getSegmentNet(arc2),sourceTraceId=netNum!==null?this.ctx.netNumToSourceTraceId.get(netNum)??void 0:void 0,transformedRoute=approximateArcPoints(start,mid,end,{segmentLength:Math.max(width,.1),minSegments:8}).map(point7=>applyToPoint(this.ctx.k2cMatPcb,point7)),startPos=transformedRoute[0],endPos=transformedRoute[transformedRoute.length-1];if(!startPos||!endPos)return;let startPcbPortId=this.findPortAtPosition(startPos,mappedLayer),endPcbPortId=this.findPortAtPosition(endPos,mappedLayer),route=transformedRoute.map((point7,index)=>({route_type:"wire",x:point7.x,y:point7.y,width,layer:mappedLayer,...index===0?{start_pcb_port_id:startPcbPortId}:{},...index===transformedRoute.length-1?{end_pcb_port_id:endPcbPortId}:{}}));this.ctx.db.pcb_trace.insert({route,source_trace_id:sourceTraceId,pcb_port_id:void 0}),this.ctx.stats&&(this.ctx.stats.traces=(this.ctx.stats.traces||0)+1)}getSegmentNet(segment2){let net=segment2?.net;return net?typeof net=="number"?net:typeof net=="object"?net._id??net.number??net.ordinal??null:null:null}findPortAtPosition(point7,layer){let ports=this.ctx.db.pcb_port.list();for(let port of ports){let layers=port.layers;if(!(layers?.length&&!layers.includes(layer))&&Math.abs((port.x??0)-point7.x)<=this.PORT_MATCH_TOLERANCE&&Math.abs((port.y??0)-point7.y)<=this.PORT_MATCH_TOLERANCE)return port.pcb_port_id}}},CollectViasStage=class extends ConverterStage{step(){if(!this.ctx.kicadPcb||!this.ctx.k2cMatPcb||!this.ctx.netNumToName)return this.finished=!0,!1;let vias=this.ctx.kicadPcb.vias||[],viaArray=Array.isArray(vias)?vias:[vias];for(let via of viaArray)this.processVia(via);return this.finished=!0,!1}processVia(via){if(!this.ctx.k2cMatPcb||!this.ctx.netNumToName)return;let at3=via.at||{x:0,y:0},pos=applyToPoint(this.ctx.k2cMatPcb,{x:at3.x,y:at3.y}),size3=via.size||.8,drill=via.drill||.4,netNum=via.net||0,netName=this.ctx.netNumToName.get(netNum)||"",mappedLayers=via.layers?getCopperSpanLayerRefsFromLayers(via.layers,this.ctx.kicadPcb):[],layers=mappedLayers.length>0?mappedLayers:getPcbCopperLayerRefs(this.ctx.kicadPcb);this.ctx.db.pcb_via.insert({x:pos.x,y:pos.y,outer_diameter:size3,hole_diameter:drill,layers}),this.ctx.stats&&(this.ctx.stats.vias=(this.ctx.stats.vias||0)+1)}},CollectZonesStage=class extends ConverterStage{step(){if(!this.ctx.kicadPcb||!this.ctx.k2cMatPcb||!this.ctx.netNumToName)return this.finished=!0,!1;let zones=this.ctx.kicadPcb.zones||[],zoneArray=Array.isArray(zones)?zones:[zones];for(let zone of zoneArray)this.isZoneFilled(zone)&&this.createCopperPourFromZone(zone);return this.finished=!0,!1}isZoneFilled(zone){if(!zone._rawChildren||!Array.isArray(zone._rawChildren))return!1;let fillEntry=zone._rawChildren.find(child=>Array.isArray(child)&&child[0]==="fill");return fillEntry&&fillEntry[1]==="yes"?!0:zone._rawChildren.some(child=>Array.isArray(child)&&child[0]==="filled_polygon")}createCopperPourFromZone(zone){if(!this.ctx.k2cMatPcb||!this.ctx.netNumToName||!zone._rawChildren||!Array.isArray(zone._rawChildren))return;let zoneData=this.parseZoneData(zone._rawChildren),filledPolygons=this.extractFilledPolygons(zone._rawChildren);if(filledPolygons.length===0){let mainPolygon=this.extractMainPolygon(zone._rawChildren);mainPolygon.length>0&&filledPolygons.push(mainPolygon)}if(filledPolygons.length===0){this.ctx.warnings&&this.ctx.warnings.push(`Zone on layer ${zoneData.layer||"unknown"} has no valid polygon points`);return}let layer=mapKicadLayerToLayerRef(zoneData.layer),netNum=zoneData.net||0,netName=this.ctx.netNumToName.get(netNum)||zoneData.netName||"";for(let polygonPoints of filledPolygons){let transformedPoints=polygonPoints.map(point7=>applyToPoint(this.ctx.k2cMatPcb,{x:point7.x,y:point7.y}));this.ctx.db.pcb_copper_pour.insert({layer,net_name:netName,points:transformedPoints,shape:"polygon"}),this.ctx.stats&&(this.ctx.stats.copper_pours=(this.ctx.stats.copper_pours||0)+1)}}parseZoneData(children){let data={};for(let child of children)if(Array.isArray(child))switch(child[0]){case"net":data.net=child[1];break;case"net_name":data.netName=child[1];break;case"layer":data.layer=child[1];break}return data}extractMainPolygon(children){let polygonEntry=children.find(child=>Array.isArray(child)&&child[0]==="polygon");return polygonEntry?this.extractPointsFromPolygonEntry(polygonEntry):[]}extractFilledPolygons(children){let filledPolygonEntries=children.filter(child=>Array.isArray(child)&&child[0]==="filled_polygon"),polygons=[];for(let entry of filledPolygonEntries){let points=this.extractPointsFromPolygonEntry(entry);points.length>0&&polygons.push(points)}return polygons}extractPointsFromPolygonEntry(polygonEntry){let points=[],ptsEntry=polygonEntry.find(child=>Array.isArray(child)&&child[0]==="pts");if(!ptsEntry)return[];for(let i3=1;i3<ptsEntry.length;i3++){let item=ptsEntry[i3];if(Array.isArray(item)&&item[0]==="xy"&&item.length>=3){let x4=item[1],y4=item[2];typeof x4=="number"&&typeof y4=="number"&&points.push({x:x4,y:y4})}}return points}},InitializePcbContextStage=class extends ConverterStage{step(){if(!this.ctx.kicadPcb)return this.finished=!0,!1;let center2=this.calculateBoardCenter();return this.ctx.k2cMatPcb=compose(scale(1,-1),translate(-center2.x,-center2.y)),this.ctx.netNumToName=new Map,this.ctx.netNumToSourceTraceId=new Map,this.ctx.footprintUuidToComponentId=new Map,this.ctx.footprintUuidToSourceComponentId=new Map,this.finished=!0,!1}calculateBoardCenter(){if(!this.ctx.kicadPcb)return{x:0,y:0};let lines=this.ctx.kicadPcb.graphicLines||[],lineArray=Array.isArray(lines)?lines:[lines],arcArray=getGraphicArcs(this.ctx.kicadPcb),circleArray=getGraphicCircles(this.ctx.kicadPcb),curveArray=getGraphicCurves(this.ctx.kicadPcb),xs3=[],ys3=[];for(let line2 of lineArray){if(!getGraphicLayerNames(line2).join(" ").includes("Edge.Cuts"))continue;let{start,end}=getLineStartEnd(line2);xs3.push(start.x,end.x),ys3.push(start.y,end.y)}for(let arc2 of arcArray){if(!getGraphicLayerNames(arc2).join(" ").includes("Edge.Cuts"))continue;let{start,mid,end}=getArcStartMidEnd(arc2);for(let point7 of approximateArcPoints(start,mid,end,{segmentLength:.25,minSegments:16}))xs3.push(point7.x),ys3.push(point7.y)}for(let circle2 of circleArray){if(!getGraphicLayerNames(circle2).join(" ").includes("Edge.Cuts"))continue;let{center:center2,end}=getCircleCenterEnd(circle2);for(let point7 of approximateCirclePoints(center2,end,{segmentLength:.25,minSegments:16}))xs3.push(point7.x),ys3.push(point7.y)}for(let curve of curveArray){if(!getGraphicLayerNames(curve).join(" ").includes("Edge.Cuts"))continue;let points=getCurvePoints(curve);if(points)for(let point7 of approximateCubicBezierPoints(points.start,points.control1,points.control2,points.end,{segmentLength:.25,minSegments:16}))xs3.push(point7.x),ys3.push(point7.y)}if(xs3.length===0||ys3.length===0)return{x:0,y:0};let minX=Math.min(...xs3),maxX=Math.max(...xs3),minY=Math.min(...ys3),maxY=Math.max(...ys3);return{x:(minX+maxX)/2,y:(minY+maxY)/2}}};function rotationToDirection(rotation5){let normalized=(rotation5%360+360)%360;return normalized>=315||normalized<45?"up":normalized>=45&&normalized<135?"right":normalized>=135&&normalized<225?"down":"left"}function inferSymbolName({libId,reference,rotation:rotation5}){let lower=libId.toLowerCase(),direction2=rotationToDirection(rotation5);if(lower.includes(":r_")||lower.includes(":r")&&reference.startsWith("R"))return`boxresistor_${direction2}`;if(lower.includes(":c_")||lower.includes(":c")&&reference.startsWith("C"))return lower.includes("polarized")||lower.includes("_pol")?`capacitor_${direction2}`:`capacitor_${direction2}`;if(lower.includes(":l_")||lower.includes(":l")&&reference.startsWith("L"))return`inductor_${direction2}`;if(lower.includes(":d_")||lower.includes("diode")||reference.startsWith("D"))return lower.includes("led")?`led_${direction2}`:lower.includes("schottky")?`schottky_diode_${direction2}`:lower.includes("zener")?`zener_diode_${direction2}`:`diode_${direction2}`;if(lower.includes(":q_")||reference.startsWith("Q"))return lower.includes("npn")?`npn_bipolar_transistor_${direction2}`:lower.includes("pnp")?`pnp_bipolar_transistor_${direction2}`:lower.includes("_n_")||lower.includes("nmos")?`n_channel_mosfet_transistor_${direction2}`:lower.includes("_p_")||lower.includes("pmos")?`p_channel_mosfet_transistor_${direction2}`:`npn_bipolar_transistor_${direction2}`;lower.includes("gnd")||lower.includes("ground")||lower.includes("vcc")||lower.includes("vdd")||lower.includes("power")}var CollectLibrarySymbolsStage=class extends ConverterStage{constructor(){super(...arguments);__publicField(this,"processedSymbols",new Set)}step(){if(!this.ctx.kicadSch||!this.ctx.k2cMatSch)return this.finished=!0,!1;let symbols=this.ctx.kicadSch.symbols||[];for(let symbol of symbols){let uuid=symbol.uuid;!uuid||this.processedSymbols.has(uuid)||(this.processSymbol(symbol),this.processedSymbols.add(uuid))}return this.finished=!0,!1}processSymbol(symbol){if(!this.ctx.k2cMatSch)return;let reference=this.getProperty(symbol,"Reference")||"U?",value=this.getProperty(symbol,"Value")||"",libId=symbol.libraryId||"",at3=symbol.at,kicadPos={x:at3?.x??0,y:at3?.y??0},cjPos=applyToPoint(this.ctx.k2cMatSch,kicadPos),rotation5=at3?.angle??0,ftype=this.inferFtype(libId,reference),sourceComponentId=`${libId}_source`;this.ctx.db.source_component.list().find(sc2=>sc2.source_component_id===sourceComponentId)||this.ctx.db.source_component.insert({name:libId||reference,ftype,manufacturer_part_number:value||void 0});let uuid=symbol.uuid;if(!uuid)return;let symbolName=inferSymbolName({libId,reference,rotation:rotation5}),componentId=this.ctx.db.schematic_component.insert({source_component_id:sourceComponentId,center:{x:cjPos.x,y:cjPos.y},size:this.estimateSize(symbol),...symbolName?{symbol_name:symbolName}:{}}).schematic_component_id;this.ctx.symbolUuidToComponentId?.set(uuid,componentId),this.createPorts(symbol,componentId),this.ctx.stats&&(this.ctx.stats.components=(this.ctx.stats.components||0)+1)}getProperty(symbol,propName){return(symbol.properties||[]).find(p4=>p4.key===propName)?.value}inferFtype(libId,reference){let lower=libId.toLowerCase();return lower.includes(":r_")||reference.startsWith("R")?"simple_resistor":lower.includes(":c_")||reference.startsWith("C")?"simple_capacitor":lower.includes(":l_")||reference.startsWith("L")?"simple_inductor":lower.includes(":d_")||reference.startsWith("D")?"simple_diode":lower.includes(":led")||reference.startsWith("LED")?"simple_led":lower.includes(":q_")||reference.startsWith("Q")?"simple_transistor":"simple_chip"}estimateSize(symbol){return{width:1,height:1}}createPorts(symbol,componentId){let libId=symbol.libraryId,libSymbol=this.ctx.kicadSch?.libSymbols?.symbols?.find(ls3=>ls3.libraryId===libId);if(!libSymbol)return;let allPins=[];if(libSymbol.pins&&Array.isArray(libSymbol.pins)&&libSymbol.pins.length>0?allPins.push(...libSymbol.pins):libSymbol.pins&&!Array.isArray(libSymbol.pins)&&allPins.push(libSymbol.pins),libSymbol.subSymbols&&Array.isArray(libSymbol.subSymbols))for(let subSymbol of libSymbol.subSymbols)subSymbol.pins&&Array.isArray(subSymbol.pins)&&subSymbol.pins.length>0?allPins.push(...subSymbol.pins):subSymbol.pins&&!Array.isArray(subSymbol.pins)&&allPins.push(subSymbol.pins);if(allPins.length===0)return;let componentRotation=symbol.at?.angle??0;for(let pin of allPins){let pinAt=pin._sxAt;if(!pinAt)continue;let rotRad=componentRotation*Math.PI/180,cosR=Math.cos(rotRad),sinR=Math.sin(rotRad),rotatedPinPos={x:pinAt.x*cosR-pinAt.y*sinR,y:pinAt.x*sinR+pinAt.y*cosR},scaleFactor=Math.abs(this.ctx.k2cMatSch?.a||1/15),relativePos={x:rotatedPinPos.x*scaleFactor,y:-rotatedPinPos.y*scaleFactor};this.ctx.db.schematic_port.insert({schematic_component_id:componentId,center:relativePos,facing_direction:this.inferPinDirection(pin,componentRotation),pin_number:pin._sxNumber?.value??pin.pinNumber??void 0})}}inferPinDirection(pin,componentRotation){let totalAngle=(pin.at?.angle??0)+componentRotation;return rotationToDirection(totalAngle)}},CollectSchematicTracesStage=class extends ConverterStage{step(){if(!this.ctx.kicadSch||!this.ctx.k2cMatSch)return this.finished=!0,!1;let wires=this.ctx.kicadSch.wires||[],wireArray=Array.isArray(wires)?wires:[wires];for(let wire of wireArray)this.processWire(wire);let junctions=this.ctx.kicadSch.junctions||[],junctionArray=Array.isArray(junctions)?junctions:[junctions];for(let junction of junctionArray)this.processJunction(junction);return this.finished=!0,!1}processWire(wire){if(!this.ctx.k2cMatSch||!wire.pts)return;let pts=Array.isArray(wire.pts.xy)?wire.pts.xy:[wire.pts.xy];if(pts.length<2)return;let edges=[];for(let i3=0;i3<pts.length-1;i3++){let from=applyToPoint(this.ctx.k2cMatSch,{x:pts[i3].x,y:pts[i3].y}),to3=applyToPoint(this.ctx.k2cMatSch,{x:pts[i3+1].x,y:pts[i3+1].y});edges.push({from,to:to3})}this.ctx.db.schematic_trace.insert({edges}),this.ctx.stats&&(this.ctx.stats.traces=(this.ctx.stats.traces||0)+1)}processJunction(junction){if(!this.ctx.k2cMatSch||!junction.at)return;let pos=applyToPoint(this.ctx.k2cMatSch,{x:junction.at.x,y:junction.at.y});this.ctx.db.schematic_trace.insert({edges:[],junctions:[pos]})}},InitializeSchematicContextStage=class extends ConverterStage{step(){if(!this.ctx.kicadSch)return this.finished=!0,!1;let KICAD_CENTER_X=105,KICAD_CENTER_Y=148.5,kicadCenterX=KICAD_CENTER_X,kicadCenterY=KICAD_CENTER_Y,cjCenterX=0,cjCenterY=0;return this.ctx.k2cMatSch=compose(translate(cjCenterX,cjCenterY),scale(1/15,-1/15),translate(-kicadCenterX,-kicadCenterY)),this.ctx.symbolUuidToComponentId=new Map,this.ctx.warnings=this.ctx.warnings||[],this.ctx.stats=this.ctx.stats||{},this.finished=!0,!1}},KicadToCircuitJsonConverter=class{constructor(){__publicField(this,"fsMap",{});__publicField(this,"ctx");__publicField(this,"currentStageIndex",0);__publicField(this,"pipeline")}get currentStage(){return this.pipeline?.[this.currentStageIndex]}addFile(filePath,content){this.fsMap[filePath]=content}_findFileWithExtension(extension){let filesWithExtension=Object.keys(this.fsMap).filter(key=>key.endsWith(extension));if(filesWithExtension.length>1)throw new Error(`Expected 0 or 1 file with extension ${extension}, got ${filesWithExtension.length}. Files: ${filesWithExtension.join(", ")}`);return filesWithExtension[0]??null}initializePipeline(){let pcbFile=this._findFileWithExtension(".kicad_pcb"),schFile=this._findFileWithExtension(".kicad_sch");this.ctx={db:cju_default([]),kicadPcb:pcbFile?parseKicadPcb(this.fsMap[pcbFile]):void 0,kicadSch:schFile?parseKicadSch(this.fsMap[schFile]):void 0,warnings:[],stats:{}},this.pipeline=[],this.ctx.kicadSch&&this.pipeline.push(new InitializeSchematicContextStage(this.ctx),new CollectLibrarySymbolsStage(this.ctx),new CollectSchematicTracesStage(this.ctx)),this.ctx.kicadPcb&&this.pipeline.push(new InitializePcbContextStage(this.ctx),new CollectNetsStage(this.ctx),new CollectFootprintsStage(this.ctx),new CollectSourceTracesStage(this.ctx),new CollectTracesStage(this.ctx),new CollectViasStage(this.ctx),new CollectZonesStage(this.ctx),new CollectGraphicsStage(this.ctx))}step(){return this.pipeline||this.initializePipeline(),this.currentStage?((!this.currentStage.step()||this.currentStage.finished)&&this.currentStageIndex++,this.currentStageIndex<(this.pipeline?.length||0)):!1}runUntilFinished(){this.pipeline||this.initializePipeline();for(let stage of this.pipeline||[])stage.runUntilFinished()}getOutput(){this.ctx||(this.initializePipeline(),this.runUntilFinished());let elements=[],tableNames=["source_component","source_port","source_trace","schematic_component","schematic_port","schematic_trace","schematic_net_label","pcb_component","pcb_port","pcb_smtpad","pcb_plated_hole","pcb_hole","pcb_trace","pcb_via","pcb_copper_pour","pcb_board","pcb_copper_text","pcb_silkscreen_text","pcb_silkscreen_path","pcb_fabrication_note_text","pcb_fabrication_note_path","pcb_fabrication_note_rect","pcb_courtyard_rect","pcb_courtyard_outline","pcb_courtyard_circle"];for(let tableName of tableNames){let table=this.ctx.db[tableName];if(table&&typeof table.list=="function"){let items=table.list();items&&Array.isArray(items)&&elements.push(...items)}}return elements}getOutputString(){return JSON.stringify(this.getOutput(),null,2)}getWarnings(){return this.ctx?.warnings||[]}getStats(){return this.ctx?.stats||{}}};var React3=__toESM(require_react(),1),debug13=(0,import_debug23.default)("tsci:eval:import-local-file"),importLocalFile=async(importName,ctx,depth=0)=>{debug13("importLocalFile called with:",{importName});let{fsMap,preSuppliedImports,importStack,currentlyImporting}=ctx,fsPath=resolveFilePathOrThrow(importName,fsMap,void 0,{tsConfig:ctx.tsConfig});if(debug13("fsPath:",fsPath),currentlyImporting.has(fsPath)){let cycleStartIndex=importStack.indexOf(fsPath),cyclePath=cycleStartIndex>=0?importStack.slice(cycleStartIndex).concat(fsPath):[...importStack,fsPath];throw new Error(`Circular dependency detected while importing "${fsPath}". The following import chain forms a cycle:
|
|
919
920
|
|
|
920
|
-
${cyclePath.join(" -> ")}`)}if(!ctx.fsMap[fsPath])throw debug13("fsPath not found in fsMap:",fsPath),new Error(`File "${fsPath}" not found`);let fileContent=fsMap[fsPath];debug13("fileContent:",fileContent?.slice(0,100)),currentlyImporting.add(fsPath),importStack.push(fsPath);try{if(fsPath.endsWith(".json")){let jsonData=JSON.parse(fileContent);preSuppliedImports[fsPath]={__esModule:!0,default:jsonData}}else if(fsPath.endsWith(".kicad_pcb")){if(fileContent==="__STATIC_ASSET__"||fileContent.startsWith("blob:"))throw new Error(`.kicad_pcb imports require local file contents. Static asset URLs are not supported for "${fsPath}".`);let converter=new KicadToCircuitJsonConverter;converter.addFile(fsPath,fileContent),converter.runUntilFinished();let circuitJson=converter.getOutput(),Board2=props=>React3.createElement("board",{...props,circuitJson});preSuppliedImports[fsPath]={__esModule:!0,default:circuitJson,Board:Board2,circuitJson}}else if(isStaticAssetPath2(fsPath)){let staticUrl;if(fileContent==="__STATIC_ASSET__")staticUrl=`${ctx.circuit.platform?.projectBaseUrl??""}/${fsPath.startsWith("./")?fsPath.slice(2):fsPath}`;else if(fileContent.startsWith("blob:"))staticUrl=`${fileContent}#ext=${fsPath.split(".").pop()}`;else{let blob=new Blob([fileContent],{type:fsPath.endsWith(".kicad_mod")?"text/plain":"application/octet-stream"}),ext=fsPath.split(".").pop()?.toLowerCase(),isStepFile=ext==="step"||ext==="stp",blobUrl=URL.createObjectURL(blob);staticUrl=isStepFile?`${blobUrl}#ext=${ext}`:blobUrl}preSuppliedImports[fsPath]={__esModule:!0,default:staticUrl}}else if(fsPath.endsWith(".tsx")||fsPath.endsWith(".ts")){let importNames=getImportsFromCode(fileContent);for(let importName2 of importNames)preSuppliedImports[importName2]||await importEvalPath(importName2,ctx,depth+1,{cwd:dirname(fsPath)});try{let transformedCode=transformWithSucrase(fileContent,fsPath);debug13("evalCompiledJs called with:",{code:transformedCode.slice(0,100),dirname:dirname(fsPath)});let typeExports=getTypeExportsFromCode(fileContent),importRunResult=evalCompiledJs(transformedCode,preSuppliedImports,dirname(fsPath));debug13("importRunResult:",{fsPath,importRunResult});let moduleExports=importRunResult.exports;typeExports.length>0&&(moduleExports.__typeOnlyExports__=typeExports),preSuppliedImports[fsPath]=moduleExports}catch(error2){throw new Error(`Eval compiled js error for "${importName}": ${error2.message}`)}}else if(fsPath.endsWith(".js")||fsPath.endsWith(".mjs")){let importNames=getImportsFromCode(fileContent);for(let importName2 of importNames)preSuppliedImports[importName2]||await importEvalPath(importName2,ctx,depth+1,{cwd:dirname(fsPath)});preSuppliedImports[fsPath]=evalCompiledJs(transformWithSucrase(fileContent,fsPath),preSuppliedImports,dirname(fsPath)).exports}else throw new Error(`Unsupported file extension "${fsPath.split(".").pop()}" for "${fsPath}"`)}finally{importStack.pop(),currentlyImporting.delete(fsPath)}};async function importSnippet(importName,ctx,depth=0){let{preSuppliedImports}=ctx,fullSnippetName=importName.replace("@tsci/","").replace(".","/"),fetchOptions={};ctx.tscircuitSessionToken&&(fetchOptions.headers={Authorization:`Bearer ${ctx.tscircuitSessionToken}`});let{cjs,error:error2}=await globalThis.fetch(`${ctx.cjsRegistryUrl}/${fullSnippetName}`,fetchOptions).then(async res2=>({cjs:await res2.text(),error:null})).catch(e5=>({error:e5,cjs:null}));if(error2){console.error("Error fetching import",importName,error2);return}if(cjs?.startsWith("{"))try{let jsonResponse=JSON.parse(cjs);if(jsonResponse.ok===!1&&jsonResponse.error)throw new Error(`"${importName}" has no files in dist, it may not be built`)}catch(e5){throw e5 instanceof Error&&e5.message.includes("has no files in dist")?e5:new Error(`Error parsing cjs response: ${e5}`)}let importNames=getImportsFromCode(cjs),staticAssetImports=[],otherImports=[];for(let subImportName of importNames)if(!preSuppliedImports[subImportName])if(subImportName.startsWith("./")&&isStaticAssetPath2(subImportName)){let assetPath=subImportName.slice(2),assetUrl=`${ctx.cjsRegistryUrl}/${importName}/${assetPath}`;staticAssetImports.push({subImportName,assetUrl})}else otherImports.push(subImportName);await Promise.all(staticAssetImports.map(async({subImportName,assetUrl})=>{try{let response=await globalThis.fetch(assetUrl,fetchOptions);if(!response.ok)throw new Error(`Failed to fetch asset: ${response.statusText}`);let blob=await response.blob(),extension=subImportName.split(".").pop()||"",blobUrl=`${URL.createObjectURL(blob)}#ext=${extension}`;preSuppliedImports[subImportName]={__esModule:!0,default:blobUrl}}catch(e5){console.error(`Error fetching static asset ${assetUrl}:`,e5),preSuppliedImports[subImportName]={__esModule:!0,default:assetUrl}}}));for(let subImportName of otherImports)preSuppliedImports[subImportName]||await importEvalPath(subImportName,ctx,depth+1);try{preSuppliedImports[importName]=evalCompiledJs(cjs,preSuppliedImports).exports}catch(e5){console.error("Error importing snippet",e5)}}var import_debug24=__toESM(require_browser(),1);function extractBasePackageName(importName){let basePackageName=importName;if(importName.startsWith("@")){let parts=importName.split("/");basePackageName=parts.length>=2?`${parts[0]}/${parts[1]}`:importName}else basePackageName=importName.split("/")[0];return basePackageName}function isPackageDeclaredInPackageJson(packageName,fsMap){let packageJsonContent=fsMap["package.json"];if(!packageJsonContent)return!0;try{let packageJson=JSON.parse(packageJsonContent),dependencies=packageJson.dependencies||{},devDependencies=packageJson.devDependencies||{},peerDependencies=packageJson.peerDependencies||{},basePackageName=extractBasePackageName(packageName);return basePackageName in dependencies||basePackageName in devDependencies||basePackageName in peerDependencies}catch{return!0}}function getNodeModuleDirectory(packageName,fsMap){let nodeModulePath=`node_modules/${extractBasePackageName(packageName)}`;return Object.keys(fsMap).some(path=>path.startsWith(nodeModulePath+"/")||path===nodeModulePath)?nodeModulePath:null}function getPackageJsonEntrypoint(packageName,fsMap){let packageJsonPath=`node_modules/${extractBasePackageName(packageName)}/package.json`,packageJsonContent=fsMap[packageJsonPath];if(!packageJsonContent)return null;try{let packageJson=JSON.parse(packageJsonContent);return typeof packageJson.browser=="string"&&packageJson.browser||packageJson.module||packageJson.main||null}catch{return null}}function isTypeScriptEntrypoint(entrypoint){return entrypoint?entrypoint.endsWith(".ts")||entrypoint.endsWith(".tsx"):!1}function isDistDirEmpty(packageName,fsMap){let distPath=`node_modules/${extractBasePackageName(packageName)}/dist`;return!Object.keys(fsMap).some(path=>path.startsWith(distPath+"/"))}var moduleExtensions=[".js",".jsx",".ts",".tsx",".json"],resolveEntrypointPath=(packageName,entrypoint,fsMap)=>{let basePackageName=extractBasePackageName(packageName),normalizedEntrypoint=normalizePackageEntrypoint(entrypoint),entrypointPath=`node_modules/${basePackageName}/${normalizedEntrypoint}`;if(fsMap[entrypointPath])return entrypointPath;for(let ext of moduleExtensions){let pathWithExt=entrypointPath.replace(/\.js$|\.jsx$/,"")+ext;if(fsMap[pathWithExt])return pathWithExt}return null};var debug14=(0,import_debug24.default)("tsci:eval:import-node-module"),importNodeModule=async(importName,ctx,depth=0)=>{let{preSuppliedImports,fsMap}=ctx;if(preSuppliedImports[importName])return;let hasPackageJson=!!fsMap["package.json"];if(hasPackageJson&&!isPackageDeclaredInPackageJson(importName,fsMap))throw new Error(`Node module imported but not in package.json "${importName}"
|
|
921
|
+
${cyclePath.join(" -> ")}`)}if(!ctx.fsMap[fsPath])throw debug13("fsPath not found in fsMap:",fsPath),new Error(`File "${fsPath}" not found`);let fileContent=fsMap[fsPath];debug13("fileContent:",fileContent?.slice(0,100)),currentlyImporting.add(fsPath),importStack.push(fsPath);try{if(fsPath.endsWith(".json")){let jsonData=JSON.parse(fileContent);preSuppliedImports[fsPath]={__esModule:!0,default:jsonData}}else if(fsPath.endsWith(".kicad_pcb")){if(fileContent==="__STATIC_ASSET__"||fileContent.startsWith("blob:"))throw new Error(`.kicad_pcb imports require local file contents. Static asset URLs are not supported for "${fsPath}".`);let converter=new KicadToCircuitJsonConverter;converter.addFile(fsPath,fileContent),converter.runUntilFinished();let circuitJson=converter.getOutput(),boardContentCircuitJson=circuitJson.filter(elm=>elm.type!=="pcb_board"),Board2=props=>React3.createElement("board",{...props,circuitJson});preSuppliedImports[fsPath]={__esModule:!0,default:circuitJson,Board:Board2,boardContentCircuitJson,circuitJson}}else if(isStaticAssetPath2(fsPath)){let staticUrl;if(fileContent==="__STATIC_ASSET__")staticUrl=`${ctx.circuit.platform?.projectBaseUrl??""}/${fsPath.startsWith("./")?fsPath.slice(2):fsPath}`;else if(fileContent.startsWith("blob:"))staticUrl=`${fileContent}#ext=${fsPath.split(".").pop()}`;else{let blob=new Blob([fileContent],{type:fsPath.endsWith(".kicad_mod")?"text/plain":"application/octet-stream"}),ext=fsPath.split(".").pop()?.toLowerCase(),isStepFile=ext==="step"||ext==="stp",blobUrl=URL.createObjectURL(blob);staticUrl=isStepFile?`${blobUrl}#ext=${ext}`:blobUrl}preSuppliedImports[fsPath]={__esModule:!0,default:staticUrl}}else if(fsPath.endsWith(".tsx")||fsPath.endsWith(".ts")){let importNames=getImportsFromCode(fileContent);for(let importName2 of importNames)preSuppliedImports[importName2]||await importEvalPath(importName2,ctx,depth+1,{cwd:dirname(fsPath)});try{let transformedCode=transformWithSucrase(fileContent,fsPath);debug13("evalCompiledJs called with:",{code:transformedCode.slice(0,100),dirname:dirname(fsPath)});let typeExports=getTypeExportsFromCode(fileContent),importRunResult=evalCompiledJs(transformedCode,preSuppliedImports,dirname(fsPath));debug13("importRunResult:",{fsPath,importRunResult});let moduleExports=importRunResult.exports;typeExports.length>0&&(moduleExports.__typeOnlyExports__=typeExports),preSuppliedImports[fsPath]=moduleExports}catch(error2){throw new Error(`Eval compiled js error for "${importName}": ${error2.message}`)}}else if(fsPath.endsWith(".js")||fsPath.endsWith(".mjs")){let importNames=getImportsFromCode(fileContent);for(let importName2 of importNames)preSuppliedImports[importName2]||await importEvalPath(importName2,ctx,depth+1,{cwd:dirname(fsPath)});preSuppliedImports[fsPath]=evalCompiledJs(transformWithSucrase(fileContent,fsPath),preSuppliedImports,dirname(fsPath)).exports}else throw new Error(`Unsupported file extension "${fsPath.split(".").pop()}" for "${fsPath}"`)}finally{importStack.pop(),currentlyImporting.delete(fsPath)}};async function importSnippet(importName,ctx,depth=0){let{preSuppliedImports}=ctx,fullSnippetName=importName.replace("@tsci/","").replace(".","/"),fetchOptions={};ctx.tscircuitSessionToken&&(fetchOptions.headers={Authorization:`Bearer ${ctx.tscircuitSessionToken}`});let{cjs,error:error2}=await globalThis.fetch(`${ctx.cjsRegistryUrl}/${fullSnippetName}`,fetchOptions).then(async res2=>({cjs:await res2.text(),error:null})).catch(e5=>({error:e5,cjs:null}));if(error2){console.error("Error fetching import",importName,error2);return}if(cjs?.startsWith("{"))try{let jsonResponse=JSON.parse(cjs);if(jsonResponse.ok===!1&&jsonResponse.error)throw new Error(`"${importName}" has no files in dist, it may not be built`)}catch(e5){throw e5 instanceof Error&&e5.message.includes("has no files in dist")?e5:new Error(`Error parsing cjs response: ${e5}`)}let importNames=getImportsFromCode(cjs),staticAssetImports=[],otherImports=[];for(let subImportName of importNames)if(!preSuppliedImports[subImportName])if(subImportName.startsWith("./")&&isStaticAssetPath2(subImportName)){let assetPath=subImportName.slice(2),assetUrl=`${ctx.cjsRegistryUrl}/${importName}/${assetPath}`;staticAssetImports.push({subImportName,assetUrl})}else otherImports.push(subImportName);await Promise.all(staticAssetImports.map(async({subImportName,assetUrl})=>{try{let response=await globalThis.fetch(assetUrl,fetchOptions);if(!response.ok)throw new Error(`Failed to fetch asset: ${response.statusText}`);let blob=await response.blob(),extension=subImportName.split(".").pop()||"",blobUrl=`${URL.createObjectURL(blob)}#ext=${extension}`;preSuppliedImports[subImportName]={__esModule:!0,default:blobUrl}}catch(e5){console.error(`Error fetching static asset ${assetUrl}:`,e5),preSuppliedImports[subImportName]={__esModule:!0,default:assetUrl}}}));for(let subImportName of otherImports)preSuppliedImports[subImportName]||await importEvalPath(subImportName,ctx,depth+1);try{preSuppliedImports[importName]=evalCompiledJs(cjs,preSuppliedImports).exports}catch(e5){console.error("Error importing snippet",e5)}}var import_debug24=__toESM(require_browser(),1);function extractBasePackageName(importName){let basePackageName=importName;if(importName.startsWith("@")){let parts=importName.split("/");basePackageName=parts.length>=2?`${parts[0]}/${parts[1]}`:importName}else basePackageName=importName.split("/")[0];return basePackageName}function isPackageDeclaredInPackageJson(packageName,fsMap){let packageJsonContent=fsMap["package.json"];if(!packageJsonContent)return!0;try{let packageJson=JSON.parse(packageJsonContent),dependencies=packageJson.dependencies||{},devDependencies=packageJson.devDependencies||{},peerDependencies=packageJson.peerDependencies||{},basePackageName=extractBasePackageName(packageName);return basePackageName in dependencies||basePackageName in devDependencies||basePackageName in peerDependencies}catch{return!0}}function getNodeModuleDirectory(packageName,fsMap){let nodeModulePath=`node_modules/${extractBasePackageName(packageName)}`;return Object.keys(fsMap).some(path=>path.startsWith(nodeModulePath+"/")||path===nodeModulePath)?nodeModulePath:null}function getPackageJsonEntrypoint(packageName,fsMap){let packageJsonPath=`node_modules/${extractBasePackageName(packageName)}/package.json`,packageJsonContent=fsMap[packageJsonPath];if(!packageJsonContent)return null;try{let packageJson=JSON.parse(packageJsonContent);return typeof packageJson.browser=="string"&&packageJson.browser||packageJson.module||packageJson.main||null}catch{return null}}function isTypeScriptEntrypoint(entrypoint){return entrypoint?entrypoint.endsWith(".ts")||entrypoint.endsWith(".tsx"):!1}function isDistDirEmpty(packageName,fsMap){let distPath=`node_modules/${extractBasePackageName(packageName)}/dist`;return!Object.keys(fsMap).some(path=>path.startsWith(distPath+"/"))}var moduleExtensions=[".js",".jsx",".ts",".tsx",".json"],resolveEntrypointPath=(packageName,entrypoint,fsMap)=>{let basePackageName=extractBasePackageName(packageName),normalizedEntrypoint=normalizePackageEntrypoint(entrypoint),entrypointPath=`node_modules/${basePackageName}/${normalizedEntrypoint}`;if(fsMap[entrypointPath])return entrypointPath;for(let ext of moduleExtensions){let pathWithExt=entrypointPath.replace(/\.js$|\.jsx$/,"")+ext;if(fsMap[pathWithExt])return pathWithExt}return null};var debug14=(0,import_debug24.default)("tsci:eval:import-node-module"),importNodeModule=async(importName,ctx,depth=0)=>{let{preSuppliedImports,fsMap}=ctx;if(preSuppliedImports[importName])return;let hasPackageJson=!!fsMap["package.json"];if(hasPackageJson&&!isPackageDeclaredInPackageJson(importName,fsMap))throw new Error(`Node module imported but not in package.json "${importName}"
|
|
921
922
|
|
|
922
923
|
${ctx.logger.stringifyLogs()}`);let nodeModuleDir=hasPackageJson?getNodeModuleDirectory(importName,fsMap):null,resolvedNodeModulePath=resolveNodeModule(importName,ctx.fsMap,"");if(hasPackageJson&&resolvedNodeModulePath){if(!nodeModuleDir)throw new Error(`Node module "${importName}" has no files in the node_modules directory
|
|
923
924
|
|